How can I use newline with the Find-And-Replace in Visual Studio?
35,787
According to Helixoft: Multiline Search and Replace in Visual Studio
you can enable Regular Expressions and then use \n
to indicate a new line.
Related videos on Youtube
![Vivian River](https://i.stack.imgur.com/VstQS.png?s=256&g=1)
Author by
Vivian River
Updated on September 17, 2022Comments
-
Vivian River almost 2 years
I've become rather fond of the "Find-And-Replace" function in Visual Studio. The function lets me replace phrases, words, symbols, or whatever you can type into the textbox on the screen.
How can I make it replace a character with a newline?
-
TriSys almost 11 yearsMake sure that you do not have Match Case or Match Whole Word set as this breaks in VS2012.
-
Michael Freidgeim over 8 yearsThere is similar question in SO Visual studio find and replace - Add carriage return, OR Newline
-
-
Charles Roberto Canato almost 10 yearsAlso, if you're Finding and must cross a line, be careful to include \r\n to indicate that, as these don't get caught in wildcards.
-
Marwin almost 10 yearsThis doesn't work in vs 2013
-
Tamara Wijsman over 9 years@Marwin: Please note that some documents contain
\r
too. It works for me in VS 2013... -
Marwin over 9 years\r\n worked, it is because of the windows line endings I guess. Thank you for the advice.