How can I make use of Visual Studio's regular expression to replace multiple lines 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
精彩评论