我可以否定使用先前的\K组吗? 我可以匹配faxbar
,funbar
,bobar
和bar
,并省略foobar
,fobar
,foooooobar
中的bar吗? https://regex101.com/r/qR9kD4/5
正则表达式
fo*\Kbar
字符串:(- 和期望结果)
foobar - no match
fobar - no match
foooooobar - no match
faxbar - match 'bar'
funbar - match 'bar'
bobar - match 'bar'
bar - match 'bar'
dontmineidontwanttfooooobematchedaatall - no match
基本上是对我的当前匹配进行反转(除了
dontmineme...
)。希望我只需要添加一个!
或类似的东西!
(?=)
。 - nhahtdh