Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Complicated regexp problem

by kevbot (Priest)
on Aug 03, 2017 at 05:12 UTC ( #1196603=note: print w/replies, xml ) Need Help??


in reply to Complicated regexp problem

I see that you have already received good advice from other monks. I just wanted to mention that item 9 in Basic debugging checklist shows how to use the YAPE::Regex::Explain module to demystify regular expressions. For example, you can see an explanation of your regex by running this
perl -MYAPE::Regex::Explain -E 'say YAPE::Regex::Explain->new("(?:ftp: +\/\/)?\/{5}(a-z_)\/")->explain()'
The output is
The regular expression: (?-imsx:(?:ftp://)?/{5}(a-z_)/) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- (?: group, but do not capture (optional (matching the most amount possible)): ---------------------------------------------------------------------- ftp:// 'ftp://' ---------------------------------------------------------------------- )? end of grouping ---------------------------------------------------------------------- /{5} '/' (5 times) ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- a-z_ 'a-z_' ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- / '/' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2019-07-17 11:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?