How to search/replace newlines
I’m trying to replace multiple newlines in a file with a single newline, but having no luck.
I tried searching for \n\n (with various options checked and unchecked), but fail to find any. I can find SINGLE newlines, but not two in a row, at least with this syntax.
Could not find any help in the app.
keep in mind that windows uses \r\n as eol.
Where as unix uses \n and mac \r.
Maybe \r\n does the trick.
I find \r\n, and thanks for that. But my replacement attempts go astray.
What I’m trying to do is make something like this
I can get of newlines in a selection by replacing \r\n with a space. But I need to eliminate empty lines.
Assuming the empty line is really empty I would use regular expression and
find what : ^$ replace with:
If you press the show all characters, is the line really empty?
Didn’t think about that. Notepad++ is so much more than Notepad :)
It shows CR LF at thened of each line, CR LF in the blank lines.
Is that equivalent to ^$?
^ marks the beginnig of a line
and $ the end.
^$ means you are looking for lines which basically have nothing then EOL chars.
Therefore replacing wouldn’t hurt other lines.
Btw. One thing i always forget Edit->Line operation->remove empty lines
Well, really, that last sentence was all I needed. :)
Guess it’s time I spent some time roaming around Notepad++ menus instead of thinking I’m using my grandad’s Notepad. :)