Similar to what Wing said about 10 years ago.. I use the following to tidy up with a 'search and delete line' regex function in NP++
<search text>\r?\n?
In Wing's example: <search text>\xd?\xa
\x
matches a hex code that corresponds to its ASCII counterpart
\xd
(or \x0d
) is used in Wing's example, instead of \r
in my example
\xd
means 'use hexadecimal d', which is 13 in decimal, and in ASCII '13' is a carriage return \r
Similarly for \xa
(or \x0a
), hexadecimal 'a' is 10 in decimal, which is a new line feed \n
in ASCII.
See https://www.asciitable.com/ for all the ascii codes
The '?
's just make them optional
So use either of these in regex mode:
<search text>\r?\n?
or
<search text>\xd?\xa?
(same thing as <search text>\x0d?\x0a?
)
For example, I often strip unnecessary lines from online courses' table of contents:
Original text:
Dictionaries, Part I
checkmark circle
6m 25s
In NPP++
Regex mode ticked
Find what: checkmark circle\r?\n?
Replace with:
New text:
Dictionaries, Part I
6m 25s