Match word not preceded by character

蓝咒 提交于 2019-12-11 10:39:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!