views:

39

answers:

1

In visual studio when we perform a search in our source code it works as if we were searching in a simple text file. But is it possible to search a phrase of a specific "type" (type is probably not the best word for what I want to express).

For example if I'm looking for 'hello' in a string I want to have in my results :

string bla = "hey hello !!!";

and not

string hello = "...";

Same with int: return int num = 34 + 2 but not int nb34 = 2

or variable name: return string myName; but not "that's myName"

C# in my example but would need it for almost any language really.

If it's not possible will there be something similar in VS 2010 ?

+2  A: 

If you go to the search window and expand Find Options, you can turn on regular expressions. That will give you more options when searching. E.g. in you example you could search for hello surrounded by quotes. That would find the word hello in strings but avoid identifiers and comments.

Brian Rasmussen
You can also choose wildcards if regex make you head hurt :)
Jason Roberts
@Jason: Fair point. I like the pain of regex :)
Brian Rasmussen