Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: regex square brackets exceptions

by moritz (Cardinal)
on Jun 21, 2011 at 13:59 UTC ( [id://910744]=note: print w/replies, xml ) Need Help??


in reply to regex square brackets exceptions

There's an easy way to check: try it out. There's another one that I like:
$ perl -Mre=debug -ce '/[a-z-[bc]]/' Compiling REx "[a-z-[bc]]" Final program: 1: ANYOF[\-[a-z][] (12) 12: EXACT <]> (14) 14: END (0) anchored "]" at 1 (checking anchored) stclass ANYOF[\-[a-z][] minlen 2 -e syntax OK Freeing REx: "[a-z-[bc]]"

It tells you that the final closing square bracket is interpreted as a literal (EXACT) match, so it surely didn't parse the regex class the same way as Java does.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-24 09:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found