Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Regexp explanation

by eXile (Priest)
on Apr 03, 2004 at 17:54 UTC ( #342325=note: print w/ replies, xml ) Need Help??


in reply to Regexp explanation

In addition to all answers you already have, in understanding/learning regex-en YAPE::Regex::Explain can be very useful:

use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(qr/((\w|')+)/)->explain(); __DATA__ The regular expression: (?-imsx:((\w|')+)) 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: ---------------------------------------------------------------------- ( group and capture to \2 (1 or more times (matching the most amount possible)): ---------------------------------------------------------------------- \w word characters (a-z, A-Z, 0-9, _) ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- ' '\'' ---------------------------------------------------------------------- )+ end of \2 (NOTE: because you're using a quantifier on this capture, only the LAST repetition of the captured pattern will be stored in \2) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------


Comment on Re: Regexp explanation
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (14)
As of 2015-07-31 19:29 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 (280 votes), past polls