How can I replace empty lines in Notepad++? I tried a find and replace with the empty lines in the find, and nothing in the replace, but it did not work; it probably needs r
A few of the above expressions and extended expressions did not work for me, but the regular expression "$\n$" did.
I did not see the combined one as answer, so search for ^\s+$ and replace by {nothing}
^\s+$ means
^ start of line
\s+ Matches minimum one whitespace character (spaces, tabs, line breaks)
$ until end of line
this work for me:
SEARCH:^\r
REPLACE: (empty)
Well I'm not sure about the regex or your situation..
How about CTRL+A, Select the TextFX menu -> TextFX Edit -> Delete Blank Lines and viola all blank line gone.
A side note - if the line is blank i.e. does not contain spaces, this will work
CTRL+A, Select the TextFX menu -> TextFX Edit -> Delete Blank Lines as suggested above works.
But if lines contains some space, then move the cursor to that line and do a CTRL + H. The "Find what:" sec will show the blank space and in the "Replace with" section, leave it blank. Now all the spaces are removed and now try CTRL+A, Select the TextFX menu -> TextFX Edit -> Delete Blank Lines
An easy alternative for removing white space from empty lines:
This will remove all trailing spaces, including trailing spaces in blank lines. Make sure, no trailing spaces are significant.