我知道用一個簡單的負回顧後找到所有的字符串沒有被另一個之間的記事本+
#(?<!first word)\r\nsecond word#s
preceeded,與任何這不會在
some text
first word
second word
some text
找到second word
和匹配的預期
some text
second word
some text
它也匹配在這裏,但它不應該
some text
first word
any other text
second word
some text
如何修改我的正則表達式以滿足要求?我試過#(?<!first word).*second word#s
,但它總是匹配。
我需要這通過許多文件在記事本中搜索++
你在用什麼語言? – Jerry 2014-12-05 11:06:35
你的第一個正則表達式正在工作https://regex101.com/r/qU7nN0/3。看,它無法在第三個塊中匹配。 – 2014-12-05 11:08:03
@Jerry它用於記事本++,在文件夾中的許多文件中進行搜索。 – 2014-12-05 11:11:45