How to change random domains to a simple domain using Notepad++

  • Ctrl+H
  • Find what: host-name\h+\K\S+
  • Replace with: mydomain.com
  • CHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all

Explanation:

host-name       # literally
\h+             # 1 or more horizontal spaces
\K              # forget all we have seen until this position
\S+             # 1 or more non-space characters

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here