I'm writing a CodeMirror extension for Brackets. To defineSimpleCodeMode I need to do some pattern matching and I'm trying to figure out how to achieve $subject.
<% if %>
While this seems to be a bad idea, I can see two ways of doing it :
<followed by anything but the
%character, then ignoring it
[^] sequence allows you to search for anything but the following character.
(?:) sequence is for non capturing groups.
(?!) sequence succeeds if it doesn't match the following character, but is not captured.
%>, you can just "reverse" the first option :
(careful here, the lookahead won't work as you need to go backwards)