-2

I would like to keep only the lines that contain one of those domains: .eu, .net, .be, .ru, .com

Please use the following list of domains as example:

example1B.com
example2F.org
exampleW3.ru
exampleHD.net
exampleC3.com
exampleVS.eu
example3Z.com
exampleC4.be
exampleC4.cz
exampleC1.org
exampleC2.be
exampleC3.xyz
exampleC5.shop
exampleC6.be
exampleC7.club
exampleC8.be
exampleC9.be
exampleC11.be
Fernando Barbosa
  • 853
  • 1
  • 8
  • 24
EdgeBT
  • 1
  • 2

2 Answers2

0

I am assuming you want to find those domains in any position of the line (in other others, it does not need to be at the end of the line).

In that case, you can use the following Regex: .*(.eu|.net|.be|.ru|.com).*

Fernando Barbosa
  • 853
  • 1
  • 8
  • 24
  • thanks for your help, this solution not good for me because it does effect domain who has "eu" or "be" example if domain has name before.shop or europe.club it will be remove i want to target only domain ltd – EdgeBT Mar 07 '23 at 22:55
0

So you need to find lines that do NOT end with a certain string. That means a negative look-behind.

But Notepad++ doesn't allow variable-length negative look-behinds (https://stackoverflow.com/a/17287598/2193968)

So that means the regex we use will need more than one negative look-behind:

^.*$(?<!\.eu)(?<!\.net)(?<!\.be)(?<!\.ru)(?<!\.com)\r?\n

So this says: match any line containing any text (including the end-of-line characters) that doesn't end with:

  • .eu
  • .net
  • .be
  • .ru
  • .com

So then, if you replace the results of that regex with nothing, then the lines that match the regex will be deleted.

Jerry Jeremiah
  • 9,045
  • 2
  • 23
  • 32