in reply to A Regex simple Question

Your have to make sure no position starts matches /ab/.
/^a(?:(?!ab).)*b$/

(?:(?!regexp).)
is to regexps as
[^chars]
is to chars.

Update: Not quite. /$pre(?(?!$regexp).)*$post/ only works when /$regexp/ can't match something /.$post/ matches.

It doesn't work in this case because /ab/ can match something that /.b/ matches. It'll fail if the input is a000ab, for example.

However, I suspect you have something closer to the following, which works fine:

/ <tag> # Start tag (?:(?!</tag>).)* # Body </tag> # End tag /x