Matt
Matt

Reputation: 27026

How can I search in source code of Visual Studio solution with AND / OR?

In Visual Studio solutions, how can you search through the entire source using more than 1 search term (for example: search for files where "fibonacci" AND "sum" is contained and display the results - likewise with OR)?

I know you can press CTRL+F, enter the first keyword and then search in the displayed results again (via: "Search in files" option), but it is not the same - and what if you need more than 2 terms to look for?

For example: If I am looking for:

"Get" AND ( "sum" OR "product")

which will find properties like

How can this be achieved?

Upvotes: 0

Views: 151

Answers (1)

rory.ap
rory.ap

Reputation: 35318

You can turn on regex and put in Fibonacci.*(Procuct|Sum) as the search expression:

enter image description here

This expression will find all instances of Fibonacci followed by zero or more characters and then followed by either Product or Sum.

There are many useful references for regular expressions; one of my favorites is this: http://www.regular-expressions.info/reference.html

Upvotes: 1

Related Questions