Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Complicated regexp problem

by stevieb (Canon)
on Aug 02, 2017 at 17:05 UTC ( #1196571=note: print w/replies, xml ) Need Help??


in reply to Complicated regexp problem

/ (?: # non capture group start ftp:\/{2} # ftp:// )? # end optional non-capture group (?: # non capture group start .*?\/ # anything non-greedy, followed by a / ){5} # end non-capture group, match five times (.*?) # capture everything, non-greedy \/ # until the very next fwd slash /x

Note that you can stringify that into a single line and put it back into the variable. The x modifier allows you to have whitespace in the regex for clarity, and adding comments.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2023-01-31 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?