如何使用 Sublime Text 的 "Find in Files" 查找包含多个不同字符串的文件?
How to use Sublime Text's "Find in Files" to find files containing multiple different strings?
我有 string1
和 string2
以及文件夹中的一堆文本文件。这些文件可能包含出现任意次数的 string1
或 string2
.
有没有一种方法可以使用 Sublime Text 的 "Find in Files..." 实用程序来查找包含 至少一次 次 each 的所有文件?
研究这个主题,我找到了一种方法来搜索 or of multiple strings (i.e. matching either matches the entire file), but what I'm trying to do is an and. On the other hand using non-consuming regular expressions as suggested in this answer 似乎在 Sublime Text 2 中根本不起作用(总是产生零匹配)。
此 RegEx 模式将使您能够找到包含每个字符串查询的文件:
(string1[\s\S]*string2)|(string2[\s\S]*string1)
[\s\S]*
用于根据需要多次匹配任何字符(包括换行符),直到找到以下字符集。
我有 string1
和 string2
以及文件夹中的一堆文本文件。这些文件可能包含出现任意次数的 string1
或 string2
.
有没有一种方法可以使用 Sublime Text 的 "Find in Files..." 实用程序来查找包含 至少一次 次 each 的所有文件?
研究这个主题,我找到了一种方法来搜索 or of multiple strings (i.e. matching either matches the entire file), but what I'm trying to do is an and. On the other hand using non-consuming regular expressions as suggested in this answer 似乎在 Sublime Text 2 中根本不起作用(总是产生零匹配)。
此 RegEx 模式将使您能够找到包含每个字符串查询的文件:
(string1[\s\S]*string2)|(string2[\s\S]*string1)
[\s\S]*
用于根据需要多次匹配任何字符(包括换行符),直到找到以下字符集。