How can I search in Visual Studio and get it to ignore what is commented out?

后端 未结 8 547
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-02 09:20

I am refactoring a C++ codebase in Visual Studio 2005. I\'m about half way through this process now and I\'ve commented out a lot of old code and replaced or moved it. Now I\'

8条回答
  •  天涯浪人
    2021-02-02 09:59

    As the other provided solutions didn't work for me, I finally discovered the following solution:

    ^~(:b*//).*your_search_term

    Short explanation:

    • ^ from beginning of line
    • ~( NOT the following
    • :b* any number of white spaces, followed by
    • // the comment start
    • ) end of NOT
    • .* any character may appear before
    • your_search_term your search term :-)

    Obviouly this will only work for // and ///-style comments.

    You must click "Use Regular Expressions " Button (dot and asterisk) on your find window to apply regex search

提交回复
热议问题