in reply to Re: How do I match a expression start with $a and not contain $b after $a
in thread How do I match a expression start with $a and not contain $b after $a

At the risk of death, you need a /s modifier if you want the intermediate junk to be able to include returns.

Also you should be using \Q and \E escapes.

/\Q$a\E(?!.*\Q$b\E)/s
(The mistake of using $a and $b for normal use was the fault of the questioner, and not you.)
  • Comment on Re (tilly) 1: Answer: How do I match a expression start with $a and not contain $b after $a
  • Download Code