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. (-:
In reply to Re: Re^2: A NOT in regular expressions (why [^%>]?)
by jryan
in thread A NOT in regular expressions
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |