问题
I'd like to match the word STOP as long as it is does not have a ' anywhere before it - so:
STOP 'something
- is legal
but ' STOP
- isn't
and neither is something ' something else STOP
I've tried using negative lookahead but I can't use quantifiers to allow unlimited whitespace / words
回答1:
If you just need to match it without any capturing, I guess something simple as
^[^']*STOP
does the trick.
来源:https://stackoverflow.com/questions/35213754/match-word-not-preceded-by-character