Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Complicated regexp problem

by kevbot (Vicar)
on Aug 03, 2017 at 05:12 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1196603]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-19 11:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found