26 Jul
2004
26 Jul
'04
11:23 a.m.
starts and ends with repeats either of which can match repeated whitespace - this is what causes the matcher to thrash trying to find a match, eventually leading to it giving up and throwing an exception, I think you could make your expression much more precise by using:
regex re("([^\n]*\\n+)+\\s+NEEDEDSUBITEM2:[^\\s]");
By moving the \s+ out side of the repeat like this the expression is now much more deterministic - it can only do one thing for any given input character.
indeed refactoring the expression solved the problem, thanks! adam