![](/img/trans.png)
[英]Regex to match a string which does not contain a specific word next to the match string
[英]Regex - match a string, but only where the next word is not 'x'
如果我有这个字符串:
“快速的棕色狐狸跳过懒狗。真是个漂亮的棕色狐狸。”
我将使用什么正则表达式匹配文本'棕色狐狸',而不是下面的单词是'那',即(匹配斜体):
“快速的棕色狐狸跳过懒狗。真是个漂亮的棕色狐狸。”
你需要一个零宽度的负前瞻断言 ,即
brown fox(?! that)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.