I have the following text in Notepad++. 37 ms N/A Dead N/S Dead N/S 37 ms N/A

How do I do a find and replace that matches "Dead" and eliminates the line with output like the following? 37 ms N/A 37 ms N/A

I have tried to use the regular expression ^.*Dead.*$ that does remove the lines, but it doesn't delete the empty spaces.

  • Unfortunately it is not the line with Dead that is the problem it is the endline at the end of the previous line before Dead. I am uncertain if you can use a regex to find a line and the endline before it.
    – SC Ghost
    Commented Jun 2, 2011 at 21:25

5 Answers 5


Go to the search then to the Mark tab, enter "Dead", check "mark line" and click "Find all". It results in bookmarks for all those lines.

In the search menu there is a point "delete bookmarked lines"

  • 1
    I like this answer!
    – vsync
    Commented Jul 1, 2011 at 19:51
  • In 7.7.1 Version. After pressing Ctr+f find 4th tab Mark. Select Bookmark line option, enter your desired string and click mark all. Now in document F2 can be used to navigate bookmarks for forward and Shift+F2 for backwards. Ctrl+F2 to toggle bookmarks. Now Find 3rd Search menu top left. Find Bookmark option at bottom. Use Remove Bookmarked Lines option to remove all lines. Commented Oct 25, 2019 at 20:34

You can use two steps:

Use regex to replace matches for ^.*Dead.*$ with markedfordel

Then in extended mode, for matches of markedfordel\r\n replace with empty


enter image description here

  • Good thing you were here, I would have blindly answered saying it could be done with only a regex before actually thinking about it.
    – MBraedley
    Commented Jun 3, 2011 at 0:29

Combine/enhance/replace your regex with the solutions here: Delete blank lines from a text file


Try a Regex replace in Notepad++ with:


That'll remove the lines for you.


You can use your first step to blank the lines that contain "Dead" in them, and then what I usually do is use one of the plugins typically included with Notepad++ to remove blank lines. To do that, I press Ctrl+A to highlight the entire document, then go to the TextFX menu (for the TextFX plugin), go to TextFX Edit, and then select Delete Blank Lines (about halfway down the menu). That will, as it said, remove all blank lines in the highlighted region.

You must log in to answer this question.