17

I need some help in Notepad++ and regular expressions.

Example how it looks at the moment:

aaaaa
bbbb
cccccc

How I want it (remove breakpoints and replace them with a comma and a blank space):

aaaaa, bbbb, cccccc

I was told that I can do it by checking "Regular expression" and "matches newline" and;

Find what: "[\r\n]+"

Replace with:","

-> Replace All

However I can't find the "matches newline" in my Replace window. Do I need any plugins for it? The version of my Notepad++ is 5.7 (UNICODE).

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
may.y
  • 173
  • 1
  • 1
  • 4

2 Answers2

36

Use the Extended search mode, replacing \r\n with ,

ScreenShot

Michael Rodrigues
  • 5,057
  • 3
  • 25
  • 51
  • 1
    +1 for the image :) this works also if you use *Regular expression* mode, not only in *Extended* search – Gabber Oct 03 '12 at 05:47
  • 2
    Yes, the image was really helpful! It seems it doesn't work when I check the Regular expression instead. Anyway, the Extended search worked, and that's enough for me:) – may.y Oct 03 '12 at 06:23
  • In other editors I've used with similar interface (e.g., Textpad) I have just entered \n as the string to find, so that if A B and C are all on separate lines and I find/replace \n with , I end up with A,B,C on one line. With Notepad++ when I do the same thing without adding in the \r, I still get 3 lines, just with a comma before the B and a comma before the C. Is there any preset combination for Notepad++ that combines the \r and \n? – WhyGeeEx Sep 14 '17 at 21:51
7

Not much complications are required for removing linebreaks using notepad++

Just select from end of line to the start of next line and press CTRL + H, you will get the text to replace and then replace it with , or your desired character

niksvp
  • 5,545
  • 2
  • 24
  • 41