Is there any way to restrict the Find/Search to uncommented lines only ?
(Maybe using regex would be a good lead)
- 1You can always collapse the commented code and uncheck "search hidden text".bzlm– bzlm2011-09-23 10:21:22 +00:00Commented Sep 23, 2011 at 10:21
- Not a direct duplicate, but I asked a related question a while ago and got some helpful suggestions: stackoverflow.com/questions/2872946/…Vicky– Vicky2011-09-23 10:37:09 +00:00Commented Sep 23, 2011 at 10:37
- 1@bzlm: Dude, I am searching the entire solution :-)Mehdi LAMRANI– Mehdi LAMRANI2011-09-23 10:56:34 +00:00Commented Sep 23, 2011 at 10:56
- 1regex will definitely work for lines starting with // but it's going to be some crazy regex to skip those contained in /**/stijn– stijn2011-09-23 11:16:13 +00:00Commented Sep 23, 2011 at 11:16
- Is there a solution for VS 2015? I tried the only given answer but it didn't seem to work and instead would never find anything..Alox– Alox2018-10-11 13:40:05 +00:00Commented Oct 11, 2018 at 13:40
Add a comment |
1 Answer
Lets say, if you need to search all occurrences of an uncommented text "VPEntity" then try using the following regular expression in Find in files after selecting the Use RegEx option
^((?!//|/\*).)*VPEntity Hope it works for you
2 Comments
Azfar
or use this ^((?!//|/*).)*VPEntity*$ or you can tweak it as per your need using any RegEx Builder tool
MHollis
and for VB.Net code it is
^((?!').)*VPEntity.*$ The .+ at the end is important, otherwise it won't match unless VPEntity is at the end of the line. This could be more robust I'm sure since a ' anywhere before the term in the line will prevent a match, not just the beginning.