http://qs321.pair.com?node_id=11136555


in reply to Regex to get file name from the path with spaces

Maybe you want to instead capture everything up to the second double quote?

.*TEXT:\s+"([^"]+)"

If you have both, lines with and lines without double quotes, you will have to show more data.

Update: After reading haukex answer, I now realize that I only understood half of your question. Use my answer to extract the full path and then use File::Spec to get the actual filename.

Replies are listed 'Best First'.
Re^2: Regex to get file name from the path with spaces
by szpt9m (Novice) on Sep 08, 2021 at 08:09 UTC
    Hi, I dont need everything upto second double quote but i need last part of the line after / which is the path name. and i need this in regex only so that i can adapt the existing code