Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: Regular Expression Question

by SquireJames (Monk)
on Dec 09, 2003 at 07:16 UTC ( [id://313378]=note: print w/replies, xml ) Need Help??


in reply to Re: Regular Expression Question
in thread Regular Expression Question

That's excellent, thanks muchly.

Now all I have to do is work out what it's doing....

Replies are listed 'Best First'.
Re**3: Regular Expression Question
by flounder99 (Friar) on Dec 09, 2003 at 14:01 UTC
    use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(qr/^(?:(?:\d+|\d+-\d+|a)(,\s*|$))+$/)- +>explain;
    outputs:
    The regular expression: (?-imsx:^(?:(?:\d+|\d+-\d+|a)(,\s*|$))+$) 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): ---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- (?: group, but do not capture (1 or more times (matching the most amount possible)): ---------------------------------------------------------------------- (?: group, but do not capture: ---------------------------------------------------------------------- \d+ digits (0-9) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- \d+ digits (0-9) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- - '-' ---------------------------------------------------------------------- \d+ digits (0-9) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- a 'a' ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- , ',' ---------------------------------------------------------------------- \s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- )+ end of grouping ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------

    --

    flounder

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-03-19 04:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found