我想搜索包含2个(或更多)特定单词的行。例如,我my function
在项目中多次出现:
my_function('test', 'test2')
my_function('test3', 'test4')
my_function(nil, 'test5')
等等。
我只想查找包含的那些事件nil
。
有什么用Sublime做到的Find in files
吗?
此RegEx模式使您可以高度控制函数中允许哪些字符:
my_function\([a-zA-Z0-9,-_'"\s]*?nil[a-zA-Z0-9,-_'"\s]*?\)
另外,如果你想有一个是发现其中包含的任何行简单的比赛my_function
之后nil
,使用:
my_function.*nil
或要以任何顺序匹配包含my_function
&的任何行nil
,请使用:
(my_function.*nil)|(nil.*my_function)
[1] my_function\(
[2] [a-zA-Z0-9,-_'"\s]*?
[3] nil
[4] [a-zA-Z0-9,-_'"\s]*?
[5] \)
组1和5包含转义括号。
组2和组4包含一个匹配的字符集:
所有字母数字字符,逗号,下划线,单引号,双引号和空格
更多信息 @:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句