I need to do a find and delete the rest in a text file with notepad+++ i want tu use RegeX to find variations on thban..... the variable always has max 5 chars behind it(see dot
You may use
Find What: (?|\b(thban\S{0,5})|\s(C3\w+))|(?s:.)
Replace With: (?1$1\n:)
Screenshot & settings
Details
(?|
- start of a branch reset group:
\b(thban\S{0,5})
- Group 1: a word boundary, then thban
and any 0 to 5 non-whitespace chars|
- or\s(C3\w+)
- a whitespace char, and then Group 1: C3
and one or more word chars)
- end of the branch reset group|
- or(?s:.)
- any one char (including line break chars)The replacement is
(?1
- if Group 1 matched,
$1\n
- Group 1 value with a newline:
- else, replace with empty string)
- end of the conditional replacement pattern