Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Parenthesis grouping into regexes.

by petdance (Parson)
on Apr 26, 2012 at 01:06 UTC ( #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


Comment on Re: Parenthesis grouping into regexes.
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 (Sexton) 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
Node Status?
node history
Node Type: note [id://967210]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2015-07-30 05:34 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 (270 votes), past polls