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 > selectFind
Menu item, or use shortcut (Ctrl
+F
)It shows the
Find
window popupGo to 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
search
menu > selectReplace
Menu item, or use 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 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