I want to remove single line breaks in my text but not double ones.
I'm able to replace lines using \r\n
. How can I remove single line breaks?
EDIT: I also need to add space before each line. For example if original text is:
line1
line2
line3
it must be converted to:
line1 line2 line3
If I've got your point - you need to convert single
\r\n
to space but leave double, triple and so on.You can use replace function of Notepad++ and this regular expression
Here we have negative lookbehind of
\r\n
, then\r\n
itself and then negative lookahead of\r\n
, so it matches single occurence of\r\n
having no predecessors and no successors of the same characters.Something like:
Note: you have to check "Regular expression" radiobutton at the bottom of form. Also field "replace with" should contain single space character.
As a result it converts following text:
into this one:
You can try to use CTRL + A and then CTRL + J