in reply to Useless use of `atomic' regex extended pattern?
To stay in the parens example: if a [^()]+ subregex matches, and the subregex after that fails, the regex engine will backtrack.
But you know that it doesn't have to, so in case of a non-matching string the explicitly non-backtracking pattern will be faster.
I don't have a perl here, but if you want to verify (or falsify) my statement, try to create a large string that doesn't match the pattern, and benchmark both the backtracking and non-backtracking example.
|
|---|