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
search
menu > selectFind
Menu item, or use the shortcut (Ctrl
+F
)It shows the
Find
window popupGo to the tab
mark
, Select or check the following things. - Find what:java
- CheckBookmark Line
- Click on theMark All
Button, It does bookmark all the matched lines - Close Find windowNext, 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 the
search
menu > selectReplace
Menu item or use the shortcut (Ctrl
+H
)It opens the
Find
andReplaces
popupPlease 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 the textjava
in 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