如何搜索含2特定字符串的所有文件? [英] How to search for all files containing 2 specific strings?

查看:175
本文介绍了如何搜索含2特定字符串的所有文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Visual Studio我想找到所有包含2特定的词(文件说,的UpdatePanel DropDownCheckList 的解决方案或项目)。换句话说,我喜欢用我自制的网络服务器控制,发现所有的文件 DropDownCheckList 与ASP.NET控件的UpdatePanel

In my Visual Studio I'd like to find all the files that contain 2 specific words (say, UpdatePanel and DropDownCheckList in a solution or project). In other words, I like to find all the files using my home-made webserver control DropDownCheckList with the ASP.NET control UpdatePanel.

怎么办呢?

推荐答案

答案取决于你的Visual Studio版本。 自2013 VS他们使用.NET正则表达式在其搜索的对话,所以解决方案看起来是这样的:

The answer depends on your Visual Studio Version. Since VS 2013 they use .net regexes in their search dialogue, so the solution would look something like:

^(?s)(?=.*Foobar)(?=.*Test)

(= ...?)是的预测先行断言

是的在线修改使也匹配换行符

使用旧版本,有一种特殊的味道正则表达式使用,所以你不能使用向前看符号:

with an older version, there is a special kind of regex flavour used, so you can not use lookaheads:

(Foobar(.|\n)+Test)|(Test(.|\n)+Foobar)

在这里我用了一个交替匹配第一个字中,那字B或第一个字B,则A字。

here I used an alternation to match first word A, then word B OR first word B then word A.

(| \\ n)的。+ 是一个解决办法要么任意字符或一个换行符匹配

(.|\n)+ is a workaround to match either any character or a newline character.

这篇关于如何搜索含2特定字符串的所有文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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