in reply to Re^2: A NOT in regular expressions (why [^%>]?)
in thread A NOT in regular expressions
The simplest solution is to just remove the quantifier, and add a negative lookahead. Then the regex becomes:
m[ <% # Opening delimiter. (?: [^%]+ # Things that can't start one. | % (?!>) # % that aren't part of a closer )* # As many non-closing-delims as you like. %> # Closing delimiter. ]x
Backtracking no longer needed. (-:
|
|---|