Search code examples
regexnotepad++

Removing empty lines in Notepad++


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 regex.


Solution

  • You need something like a regular expression.

    You have to be in Extended mode

    If you want all the lines to end up on a single line use \r\n. If you want to simply remove empty lines, use \n\r as @Link originally suggested.

    Replace either expression with nothing.