Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 是否有正则表达式来查找记事本中的某个单词++;_Regex_Notepad++ - Fatal编程技术网

Regex 是否有正则表达式来查找记事本中的某个单词++;

Regex 是否有正则表达式来查找记事本中的某个单词++;,regex,notepad++,Regex,Notepad++,我想使用记事本++中的“查找当前文档中的所有内容”按钮来查找单词列表的所有实例。可以用正则表达式来实现这一点吗 例如,如果单词列表为 Foo,man,choo 记事本++中的文件包含 01 The quick brown fox jumps over the lazy dog 02 The quick brown fox jumps over the lazy dog 03 The quick brown man jumps over the lazy dog 04 The quick bro

我想使用记事本++中的“查找当前文档中的所有内容”按钮来查找单词列表的所有实例。可以用正则表达式来实现这一点吗

例如,如果单词列表为

Foo,man,choo
记事本++中的文件包含

01 The quick brown fox jumps over the lazy dog
02 The quick brown fox jumps over the lazy dog
03 The quick brown man jumps over the lazy dog
04 The quick brown fox jumps over the lazy dog
05 The quick brown fox jumps over the lazy dog
06 The quick brown foo jumps over the lazy dog
07 The quick brown fox jumps over the lazy dog
08 The quick brown fox jumps over the lazy dog
09 The quick brown choo jumps over the lazy dog
10 The quick brown fox jumps over the lazy dog

第3行、第6行和第9行将在查找结果中返回。

这应该可以做到-使用or运算符。。。没有括号也可以用

(Foo|man|choo)

如果您只想匹配这些单词,那么可以使用

(foo|man|choo)
结果:

foo
man
choo
03 The quick brown man jumps over the lazy dog
06 The quick brown foo jumps over the lazy dog
09 The quick brown choo jumps over the lazy dog
但是如果您想匹配整行,您可以使用其中一个单词

^.*(foo|man|choo).*$
结果:

foo
man
choo
03 The quick brown man jumps over the lazy dog
06 The quick brown foo jumps over the lazy dog
09 The quick brown choo jumps over the lazy dog

记事本++从6.1.1版本开始支持管道操作符
|

您可以使用此正则表达式进行搜索:

^.*(Foo|man|choo).*$

不确定记事本++,但通常
(foo | man | choo)
(使用管道)将分离匹配项。在搜索选项中启用正则表达式模式