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.

How to do it?
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)
(?=...) is a lookahead assertion
(?s) is an inline modifier to make the . matches also newline characters
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)
here I used an alternation to match first word A, then word B OR first word B then word A.
(.|\n)+ is a workaround to match either any character or a newline character.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With