Regular Expression Backtracking Problem
807606Mar 21 2007 — edited Mar 22 2007I have a complex regular expression along the lines of
[extremely_long_expression_with_lots_of_wildcards]abcdefg
It takes several minutes for the Java regex parser to determine that the string against which I'm matching the expression does not contain 'abcdefg'. It appears to be "backtracking" and trying to find some sort of match in the long expression, even though the complete expression cannot match due to the absence of 'abcdefg'.
Is there a way to make the parser look first for 'abcdefg', notice that it's not in the string, and fail immediately?