127

How do I replace the string "\r\n" with the same characters?

Example:

Hello World.\r\nHello World.

replaced with:

Hello World.
Hello World.
Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
C. Ross
  • 6,174
  • 16
  • 62
  • 82

4 Answers4

224

Press CTRL-h and the Replace dialog will open. Type \\r\\n in "Find what" and \r\n in "Replace with". Finally, select search mode Extended (\r, \n, \t, \x..., \0) and click "Replace All".

Marcus Mangelsdorf
  • 1,207
  • 2
  • 12
  • 19
drrlvn
  • 6,155
  • 2
  • 21
  • 11
14

In the find screen, on the replace tab choose extended search.
In the find text box put \\r\\n, and in the replace text box put \r\n.

C. Ross
  • 6,174
  • 16
  • 62
  • 82
2

I tried the top voted answer, but I couldn't get it to work for my newer version of Notepad++. I had to reverse what they did. So:

Press CTRL-h and the Replace dialog will open. Type \r\n in "Find what" and \\r\\n in "Replace with". Then select search mode Extended (\r, \n, \t, \x..., \0) and click "Replace All".

Literally what Marcus did but reversed worked for me.

  • 1
    This doesn't answer the question. – Toto Oct 23 '18 at 15:14
  • 1
    your way will convert the real the new line to the literal `\r\n` in the file, whereas the question is about **converting the literal `\r\n` to new lines** – phuclv Oct 23 '18 at 17:03
  • I had text just like OP in my notepad++, and it worked. Where it would literally say something like: *Hello World.\r\nHello World.* to be: Hello World With my version of Notepad++, doing the top voted answer did not fix it for me, but switching it did work for me. (I can't get stack overflow to register that I put a new line in between Hello and World... So just know that between Hello and World, it has a new line like how it should) – Sara Richardson Oct 29 '18 at 16:00
1

Copy a newline and use the Search and Replace function to replace \r\n with the newline. The newline character will show up as an empty box.

Linus
  • 697
  • 3
  • 10