In Visual Studio 2010, how do you search for text that is not within a single line comment?

后端 未结 2 1925
忘掉有多难
忘掉有多难 2021-01-02 10:51

In Visual Studio 2010, how do you search for text that is not within a single line comment? E. G. how to find \"bas\" in:

foo bar bas

but n

2条回答
  •  -上瘾入骨i
    2021-01-02 11:32

    In the Visual Studio Find dialog, try using this regular expression (make sure to select Use: Regular expressions in the Find options):

    ~(//[.:b]*)
    

    This should find all occurrences of the word bas which are not preceded by //.

    Note that the Visual Studio regex syntax is a bit different than the conventional syntax. You can find the reference HERE.

提交回复
热议问题