Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Parenthesis grouping into regexes.

by petdance (Parson)
on Apr 26, 2012 at 01:06 UTC ( [id://967210]=note: print w/replies, xml ) Need Help??


in reply to Parenthesis grouping into regexes.

This is a well-solved problem. Suggest you check out Regexp::Common.

xoxo,
Andy

Replies are listed 'Best First'.
Re^2: Parenthesis grouping into regexes.
by mbethke (Hermit) on Apr 26, 2012 at 06:31 UTC

    Regexp::Common doesn't support IPv6 addresses though. Regexp::IPv6 does, however it creates quite a monster just to match the third form from RFC 4291 section 2.2 (mixed hex/decimal) that I've never seen used anywhere. This is (supposedly, I haven't tested it) a much shorter version:

    qr/^(((?=(?>.*?::)(?!.*::)))(::)?(([0-9A-F]{1,4})::?){0,5}|((?5):){6})(\2((?5)(::?|$)){0,2}|((25[0-5]|(2[0-4]|1[0-9]|[1-9])?[0-9])(\.|$)){4}|(?5):(?5))(?<![^:]:|\.)\z/i
Re^2: Parenthesis grouping into regexes.
by aramisf (Beadle) on Apr 26, 2012 at 19:48 UTC
    Pretty nice library. Didn't know it.
    Very useful indeed.

    Thanks for the tip.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found