[英]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.