Languages
[Edit]
EN

Remove empty lines with regex in Notepad++

11 points
Created by:
AnnLen
1798

In this article we are going to look how to remove empty lines with Notepad++.

Presented below solution uses regex to do it (uses regular expressions).

Quick steps:

  1. open Notepad++,
  2. go to Replace window (in menu Search -> Replace... or press ctrl + H),
  3. in Search Mode group-box select Regular expression radio button,
  4. enter below regex in Find what input:

    ^\R
  5. enter below line in Replace with input:

    >> Leave it EMPTY <<
  6. click on Replace All button

  • Text before:

    line 1
    
    
    line 2
    
    line 3
    line 4
  • Text after:

    line 1
    line 2
    line 3
    line 4

Look at below screenshots:

Remove all empty lines with regex in Notepad++
Remove all empty lines with regex in Notepad++
Removed all empty lines with regex in Notepad++
Removed all empty lines with regex in Notepad++

 Reference

  1. Notepad++ - Wiki
  2. Download Notepad++
Hey ūüĎč
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.