Delete a line containing a specific word
I want to delete all lines containing the word "False"
For example, if I have a text file containing the following:
Before
MyEmail@gmx.net|J|1983>2012>3000|Good|[0=%]
MyEmail@hotmail.net|N|1985>2012>3000|False|[~~~'#'***+++~~~]
MyEmail@hotmail.net|N|1985>2012>3000|Good|[$"$!]|Number 2123
After
MyEmail@gmx.net|J|1983>2012>3000|Good|[0=%]
MyEmail@hotmail.net|N|1985>2012>3000|Good|[$"$!]|Number 2123
What regex should I use in Notepad ++ to remove unwanted lines?
source to share
The latest version of Notepad ++ (v6.0) supports PCRE, so you can:
find: .*?False.*\r?\n
replace with:nothing
source to share
It is most likely as simple as going into the Notepad ++ tool menu and typing in the text to search for, and then instructing to delete every line it is on.
Otherwise, a normal regex to identify the entire string might be something like this:
to repeat
If the default is (.) Like nothing but a newline, then it is
.*False.*\n?
else, this
[^\n]*False[^\n]*\n?
They must match the entire line (plus a newline) if the line is "False".
Anything that looks more like "False" needs to be surrounded by delimiters, this is additional logic.
source to share
You can not. Notepad ++ does not support mixing RegExps with line ends
Deleting the end of a line or concatenating lines is only possible in advanced mode.
The "Extended" option shows \ n and \ r as characters that can be matched. As with normal search mode, Notepad ++ searches for the exact character.
source to share
You cannot do this with a regex in one step, but there is a two step process when using bookmarks.
The Find dialog has a Bookmark option that can be used, among other things, to flag the rows that match your delete query. In newer versions of Notepad ++, this has been moved to the Mark tab of the Find dialog box.
After the lines you want have been bookmarked, from the menu bar, select Search> Bookmark> Remove Bookmarks. As the name suggests, this will delete all lines marked in the previous search.
source to share