Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Regex to get file name from the path with spaces

by Corion (Patriarch)
on Sep 08, 2021 at 07:48 UTC ( [id://11136555]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11136555]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-23 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found