Notepad++ delete until colon for every line with replace all

notepadregex

I'm using Notepad++ Replace box to delete text to the left of the colon (:) in all 3 lines of my file:

TRACE: do

TRACE: re

TRACE: mi

I'm using ^[^:]+: in the 'Find what:' field and 'Replace with:' is empty but when it goes to the next line it automatically selects and deletes what was output in the previous line, so when I run Replace All it results in:

mi

It should show:

do

re

mi

Best Answer

It's a "bug" ("feature") of Notepad++, you have to capture the rest of the line and use the value in replace:

  • Find what: ^[^:]+:(.+)$
  • Replace with: $1
  • check Wrap around
  • check Regular expression
  • UNCHECK . matches newline
  • Replace all

Another way is:

  • Find what: ^[^:\r\n]+:
  • Replace with: LEAVE EMPTY
Related Question