Tests that cause problems, but are "legal" regexes. These all have a '*' or '+' following a regex that can be zero-length. These will raise an exception while searching, though not while compiling. ()* - c - - a** - c - - (a*)* - c - - (a*)+ - c - - (a|)* - c - - (a*|b)* - c - - (^)* - c - - (ab|)* - c - - ((a*|b))* - c - - These are similar to the above, but don't raise an exception, since there's only a maximum of one possible match of the subexpression. So these are safe to use, though probably shouldn't be legal. ^* - c - - a*? - c - - Wrong-order ranges in charsets. They are legal, don't cause exceptions, but are shady. It will consider the first character as in the set, but since it's a negative range, no other characters are considered part of the range. In the tests below, the first will match, but the other three won't. a[c-a] ac y - - a[c-a] ab n - - a[c-a] aa n - - a[c-a] a- n - -