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

后端 未结 2 1923
忘掉有多难
忘掉有多难 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条回答
  •  隐瞒了意图╮
    2021-01-02 11:42

    Okay, so I asked this question just so I could refer back to my own answer.

    Visual Studio doesn't seem to have the typical look-ahead, look-behind constructs. It does have a similar zero-width negative assertion. The syntax is ~(x) which means the pattern does not match x at this point in the pattern. Using this construct, I came up with this: ^(.~(//))*bas Which works really well, but won't exclude a line where // are the first two characters on the line. A version to fix that is: ^~(//)(.~(//))*bas

提交回复
热议问题