Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Regex help

by Anonymous Monk
on Sep 10, 2012 at 03:58 UTC ( #992659=note: print w/ replies, xml ) Need Help??


in reply to Regex help

Because it does :) Add

use re 'debug';
and watch the regex engine match the thing

Also see

use YAPE::Regex::Explain; print YAPE::Regex::Explain->new( qr/(.+)(\/path\/)(.+)(\/.+)/ )->explain; __END__ The regular expression: (?-imsx:(.+)(/path/)(.+)(/.+)) 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 and capture to \1: ---------------------------------------------------------------------- .+ any character except \n (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- ( group and capture to \2: ---------------------------------------------------------------------- /path/ '/path/' ---------------------------------------------------------------------- ) end of \2 ---------------------------------------------------------------------- ( group and capture to \3: ---------------------------------------------------------------------- .+ any character except \n (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \3 ---------------------------------------------------------------------- ( group and capture to \4: ---------------------------------------------------------------------- / '/' ---------------------------------------------------------------------- .+ any character except \n (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \4 ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------


Comment on Re: Regex help
Select or Download Code
Re^2: Regex help
by yoda54 (Monk) on Sep 10, 2012 at 04:07 UTC
    Thanks!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2015-07-04 21:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls