javascriptregexproxmox

Except or exclude authorized email domain


I have follow this comment and I've change a few adjustments to

\w+[-.w]*@(?!.+(com|co.kr|net|org))\w[-.\w]*\.+\w{2,4}$

for match any domain, but except ".com" , ".net" , "co.kr" , ".org" and contents in email body it's working fine. image_1 image_2

But if there is ".com" , ".net" , ".org" and "co.kr" before another domain. Or there is any symbol ( = , + ) it cannot match in this below. image_3

Where do I change to fix this?


Solution

  • Today I've adjust regex completed. Exclude all desired domain (".com" , ".net" , ".org" and "co.kr") and another contents in email body.

    (?i)[\w.+\-]{0,50}@[\w.+\-]{0,50}(?!.+(com|net|org|co.kr)).\w{2,5}\.\w{2,5}
    

    The result is perfect. img_complete