This post explains How to remove the line that contains text in Notepad++. Use the Find and replace feature using regular expressions. the third way.
For example, File content with the following content.
This is test content
This is test content4
This is a test of 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 expressions.
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 the
searchmenu > selectFindMenu item, or use the shortcut (Ctrl+F)It shows the
Findwindow popupGo to the tab
mark, Select or check the following things. - Find what:java- CheckBookmark Line- Click on theMark AllButton, It does bookmark all the matched lines - Close Find windowNext, Go to
Search>Bookmark>Remove Bookmarked LinesIt 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 the
searchmenu > selectReplaceMenu item or use the shortcut (Ctrl+H)It opens the
FindandReplacespopupPlease select the following options in the popup
- Find what:
.*java.*\r?\n - Replace With space(``).
- Search Mode: Check the
Regular Expressionradio button - Click on the
Replace Allbutton, It removes the line that contains the textjavain the text file and can be saved. - Following is the output
- Find what:
This is test content
This is test content4
This is test content
This is test content
This is test content