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

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?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2023-02-06 06:38 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (33 votes). Check out past polls.