in reply to Re: Re: Email suffix matching with a negative look-ahead regexp
in thread Email suffix matching with a negative look-ahead regexp

Thanks, it's working!

junior:~$ perl -e 'die if "foo@spammer.tw"=~/^.+\.(?!br|com|net|org)\w ++$/' Died at -e line 1.

OT: I receive much spam from international domains, and with this regexp the msg is sent to a special folder. I don't have problems, because the mailing-lists emails are filtered before.

  • Comment on Re: Re: Re: Email suffix matching with a negative look-ahead regexp
  • Download Code

Replies are listed 'Best First'.
Re**4: Email suffix matching with a negative look-ahead regexp
by xmath (Hermit) on Mar 02, 2003 at 00:13 UTC
    OT, a good way to test patterns like these is:
    perl -lne 'print /^.+\.(?!br|com|net|org)\w+$/ ? "spam" : "ok"'

    Every line of input will be tested, so you can try out various email addresses to see if it matches properly

    Maybe you already knew the -n option, but I thought I'd mention it in case you don't