$ 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.
In reply to Re: regex square brackets exceptions
by moritz
in thread regex square brackets exceptions
by raybies
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |