Search and replace in Visual Studio

后端 未结 6 818
遥遥无期
遥遥无期 2020-12-29 03:52

In Visual Studio, when I search within a selection, I want to replace the first instance (or second, third, etc.) of a match per line using regular expressions. How would I

6条回答
  •  独厮守ぢ
    2020-12-29 03:59

    In Visual Studio 2012, capture groups and backreferences are used just like in C#. You can capture them with common parenthesis, and backreference them with $0, $1, etc. Hope it helps!

    Note that the syntax $1 is used for find-replace, but \1 is used for backreferences in the search string.

提交回复
热议问题