Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find and replace - Add carriage return OR Newline

In the case of following string to be parsed.

ford mustang,10,blue~~?bugatti veyron,13,black 

I want to replace the ~~? with a carriage return

Replacing with \n just adds the string "\n"

How can this be done?

like image 970
Mantisimo Avatar asked Dec 02 '10 15:12

Mantisimo


People also ask

How do I insert a carriage return in Find and Replace Mac?

In TextEdit, open the find feature. Then, click on the "Replace" checkbox. Place your cursor in the replace text field and type ctrl+shift+return. This should insert a carriage return character that you can use for replacement.


2 Answers

Make sure "Use: Regular expressions" is selected in the Find and Replace dialog:

Find/Replace Dialog Use Regular expressions

Note that for Visual Studio 2010, this doesn't work in the Visual Studio Productivity Power Tools' "Quick Find" extension (as of the July 2011 update); instead, you'll need to use the full Find and Replace dialog (use Ctrl+Shift+H, or Edit --> Find and Replace --> Replace in Files), and change the scope to "Current Document".

like image 132
Martin Avatar answered Oct 31 '22 07:10

Martin


You can also try \x0d\x0a in the "Replace with" box with "Use regular Expression" box checked to get carriage return + line feed using Visual Studio Find/Replace. Using \n (line feed) is the same as \x0a

like image 34
Dean Avatar answered Oct 31 '22 07:10

Dean