我知道用一个简单的负回顾后找到所有的字符串没有被另一个之间的记事本+
#(?<!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