Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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

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
Node Status?
node history
Node Type: note [id://967210]
help
Chatterbox?
LanX hungry for fool
[shmem]: LanX: now I have to find a succinct transformation FOOL => MONK
[LanX]: yeah but Marto already proposed a new "Lex Sun-D" ...
[karlgoethebier]: the word really exists: http://www. urbandictionary. com/define.php? term=fool
[shmem]: ...possibly involving RTFM
[karlgoethebier]: big surprise!
[Eily]: LanX I try to avoid answering, but I did feel that this one post was going into much detail to prove a false claim (that SHA-1 is secure, I was just wrong about how insecure it is)
[LanX]: ironically...
[LanX]: yeah whatever ... I'm in the favorable condition to already autohiding him ... how can I judge the poor FOOLs who still see his contributions xD
[Eily]: he's been pretty saavy about threads that were implictly about him in the past. I think he might have deliberatly avoiding mentioning it for some reason (he got tired?)

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2017-07-24 17:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (356 votes). Check out past polls.