Joh*_*ust 3 regex search notepad++
我在文档中寻找以下文字:
"substr"
"500"
"description"
Run Code Online (Sandbox Code Playgroud)
我使用以下表达式来尝试匹配:
(substr|500|description)
Run Code Online (Sandbox Code Playgroud)
这可以找到任何这些单词,但我想跳到只包含所有这些单词的行.有没有办法做到这一点?我不想要OR条件,我想对所有这些词进行AND.
例如:
test substr line one
test substr, 500 line two
test substr, 500, description line three <<--- only go to this line when I hit next!!
Run Code Online (Sandbox Code Playgroud)
这可能吗?
要以任何顺序匹配它们,您可以使用正向前瞻 ?=:
((?=.*\bsubstr\b)(?=.*\b500\b)(?=.*\bdescription\b).*)
Run Code Online (Sandbox Code Playgroud)
要按给定的顺序匹配它们要容易得多:
.*substr.*500.*description.*
Run Code Online (Sandbox Code Playgroud)