Search and replace in Visual Studio

后端 未结 6 829
遥遥无期
遥遥无期 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 04:05

    If you would be more variable:

    Regex.Replace(input, @"(?<=\= )[^;0-9]*(?=[0-9]*;)", replacewith);
    

    This search for = and (anynumber); and replace that between.

    Edit: The number is optional.

提交回复
热议问题