如何在 Eclipse 中搜索文件,以便结果显示不包含搜索词的文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1149057/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:54:13  来源:igfitidea点击:

How do I search files in Eclipse so the results shows files that do NOT contain the search term?

eclipsesearch

提问by Cambo

In Eclipse editor, if I go Search->File, I can search for files that contain my search term. What I want to do is find all of the files that DO NOTcontain my search term. Is that possible?

在 Eclipse 编辑器中,如果我转到“搜索”->“文件”,我可以搜索包含我的搜索词的文件。我想要做的是找到所有包含我的搜索词的文件。那可能吗?

采纳答案by ymir

Try checking "regular expression" option and then input somethign like [^term] or (?!term) -- meaning of both of this is 'not term' but they are slightly different (please refer to some RegExp documentation like this).

尝试检查“正则表达式”选项,然后输入诸如 [^term] 或 (?!term) 之类的东西——这两者的含义都是“非术语”,但它们略有不同(请参阅一些像这样的RegExp 文档)。

回答by noup

This expression should work (reference):

这个表达式应该有效(参考):

(?s)\A((?!YourSearchText).)*\Z

回答by Andrejs

The simplest way imo is to use InstaSearch Eclipse pluginand type:

imo 最简单的方法是使用InstaSearch Eclipse 插件并输入:

search text -wordToExclude -anotherWordToExclude

search text -wordToExclude -anotherWordToExclude