So I've got a list of dns-name and i'd like to filter out all the ones that are generic using preferrably Notepad++.

So for example

Name: test-14.45.name.other.com  

Name: cottoncandy.fun.com  

Obviously the easiest part is to bookmark the generic names (test-14.45) and remove them since they all have some parts on the name in common.

So what I'm wondering is, how do I bookmark the address field below every non-generic dns-name?

  • What is your expected output? And, please give more examples and criteria. – Toto Sep 12 '18 at 11:22
  • My expected output is for the generic dns-names to be removed, as for their IP-addresses too. So that I can get a list of the non-generic dns-names and their IPs. – Oscar Sep 12 '18 at 11:26
  • What character do you have after p-208? Are thay only digits, letter, any kind of character? – Toto Sep 12 '18 at 12:04
  • What lines do you want to delete? Only those that have p208- at the begionning of the name? Or other criteria? – Toto Sep 12 '18 at 12:06
  • 2 random digits. – Oscar Sep 12 '18 at 12:06
  • Ctrl+H
  • Find what: ^Name:\h+test-\d+\.\d+.+\R.+(?:\R\R?|$)
  • Find what: ^Name:\h+p208-\d{1,2}.+\R.+(?:\R\R?|$)
  • Replace with: LEAVE EMPTY
  • check Wrap around
  • check Regular expression
  • DO NOT CHECK . matches newline
  • Replace all


^           : beginning of line
Name:       : literally
\h+         : 1 or more horizontal spaces
p208-       : literally
\d{1,2}     : 1 or 2 digits
.+          : 1 or more any character but newline
\R          : any kind of linebreak (i.e. \r or \n or \r\n)
.+          : 1 or more any character but newline
(?:         : start non capture group
    \R\R?   : 1 or 2 linebreak
  |         : OR
    $       : end of line
)           : end group


Name: p208-14.45.name.other.com  

Name: cottoncandy.fun.com  

Name: p208-14.44.name.other.com  

Result for given example:

Name: cottoncandy.fun.com  
  • I added a picture in my post, check it out. Can't get it to work. I feel pretty silly. – Oscar Sep 12 '18 at 12:00
  • @Oscar: Have you got any message? What version of Notepad++? (Here, I have 7.5.8) – Toto Sep 12 '18 at 12:01
  • I'm running 7.5.7, no message. – Oscar Sep 12 '18 at 12:03
  • @Oscar: See my edit. Is that what you want? – Toto Sep 12 '18 at 12:13
  • @Oscar: You're welcome, glad it helps. – Toto Sep 12 '18 at 12:18

You can Find and remove them, use below regular expression to find entries to delete, than delete them.


make sure "regular expression" is selected and ". matches newline" is blank.

enter image description here

  • so if i wanted to mark every name that starts with "d142", and the address line below, how would i do that? – Oscar Sep 12 '18 at 11:37
  • .*d142.*\r\nAddress.* – Máté Juhász Sep 12 '18 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.