Eclipse文件搜索模式中恰好出现了两次 [英] Eclipse file search pattern for exactly two occurences

查看:44
本文介绍了Eclipse文件搜索模式中恰好出现了两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对显示为此处.我想找到包含 string1和string2 的文件.不是string1或string2.最重要的是,字符串可以位于不同的行上.我在SO上搜索了它,但是我只用or子句找到了它,而正则表达式用于同一行.你能帮我吗?

我正在寻找的是这样的.

但是,我正在使用Windows,但我的选择受到限制.我可以在Eclipse上实现吗?

Ctrl + H .转到文件搜索标签,选择/选中正则表达式" 按钮,然后在包含文本文本框中,使用打击正则表达式

(?m)(?s).*(string1).*(string2).* ->首先搜索string1,然后搜索string2.

如果要先搜索string2,则使用(?m)(?s).*(string2).*(string1).* .

要了解(?m)和(?s),请转到此处

I want to run file search over files like the guy shown here. I want to find the files containing string1 and string2 . Not string1 or string2. And most importantly the strings can be on different lines. I searched SO for it but I only found it with or clause and the regex is for the same line. Can you help me?

What I am looking for is some like this.

However I am using windows and my options are limited. Can I achieve this on eclipse?

解决方案

Press Ctrl+H. Go to File Search tab select/check the "Regullar Expression" button and in the Containing text text box, use the blow regular expression

(?m)(?s).*(string1).*(string2).* --> Searches string1 first then string2.

If you want string2 to be searched first then use (?m)(?s).*(string2).*(string1).*.

To know about (?m) and (?s) go here

这篇关于Eclipse文件搜索模式中恰好出现了两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆