开发者

How can I make use of Visual Studio's regular expression to replace multiple lines of code?

开发者 https://www.devze.com 2022-12-21 13:08 出处:网络
Is it possible to make use of Visual Studio 2005/2008 \"Find\" and \"Replace\" functionality along with regular expression to replace multiple lines of already coded C# code into a single line of code

Is it possible to make use of Visual Studio 2005/2008 "Find" and "Replace" functionality along with regular expression to replace multiple lines of already coded C# code into a single line of code?

Note that Visual Studio's "Find" and "Replace" regular expression synta开发者_高级运维x differs from .NET Framework.


Try:

.|\n

The "." matches any character, the "\n" matches a newline character, and the "|" tells you to match either the "." or the "\n."


\n is the newline character in the Find & Replace syntax. Just replace \n with nothing.


Tested:

In the find & replace dialog: Get everything between "START" and "END"

START(.|\n)*?END

0

精彩评论

暂无评论...
验证码 换一张
取 消