This post explains shows How to remove the line that contains text in Notepad++. Use the Find and replace feature using regular expression. the third way. For example, File content with the following content.

This is test content
This is test content4
This is test java content5
This is test content
This is test content
This is test content

You want to remove the lines that contain the text java in the file.

Notepad++ provides find and replace features to edit and remove lines using regular expression.

How to remove every line that contains text in Notepad++

There are multiple ways we can remove it.

One way is a bookmark feature.

  • Open search menu > select Find Menu item, or use shortcut (Ctrl + F)

  • It shows the Find window popup

  • Go to tab mark, Select or check the following things. - Find what: java - Check Bookmark Line - Click on the Mark All Button, It does bookmark all the matched lines - Close Find window

  • Next, Go to Search > Bookmark > Remove Bookmarked Lines

  • It removes all the lines that are bookmarked in the text file.

Another way, use regular expression with the find and replace feature in notepad++.

Following are steps

  • Open search menu > select Replace Menu item, or use shortcut (Ctrl + H)

  • It opens the Find and Replaces popup

  • Please select the following options in the popup

    • Find what: .*java.*\r?\n

    • Replace With space(``).

    • Search Mode: Check the Regular Expression radio button

    • Click on the Replace All button, It removes the line that contains text java in the text file, and can be saved

    • Following is the output

      ```markup
      This is test content
      This is test content4
      This is test content
      This is test content
      This is test content
      ```