My regex is: /(?<!start )".*?"/
- it searches for quotes in text (actually for string literals in code)
For me, it works perfectly with these cases:
But with cases like this it doesn't:
How can I make the regex negative lookbehind consume discarded text?
You can use SKIP FAIL. There are other ways too, if you elaborate:
start\s+"[^"\r\n]*"(*SKIP)(*F)|"[^"\r\n]*"
Or:
\bstart\s+"[^"\r\n]*"(*SKIP)(*F)|"[^"\r\n]*"
\bstart\s+"[^"\r\n]*"(*SKIP)(*F)
: matches first what you don't want, then it uses SKIP FAIL to remove it from results.
"[^"\r\n]*"
: All is left is what you want to match.