[Mimedefang] Regexp Help

Steffen Kaiser skmimedefang at smail.inf.fh-bonn-rhein-sieg.de
Wed Oct 29 04:38:25 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 28 Oct 2008, Ashley M. Kirchner wrote:

>   return('ACCEPT_AND_NO_MORE_FILTERING', "ok") if    \
>           ($recipient =~ /.+\@somedomain\.com>?/i);

First of all, you must anchor the regex, because you match any address 
that has the domain at the beginning of the domain, e.g.:

somedomain.commer.edu
somedomain.com.tw

(the >? is actually a NOOP, because of the missing anchor).

I suggest

/.+\@somedomain\.com>?\z/i

\z is: Match only at end of string (and never a \n in the middle)

>   This was done on purpose to bypass the checking for some of our hosted 
> domains.  How do I change that to apply for a specific e-mail address, say 
> 'edward at scissorhand.com' ?

replace the .+ part with the localpart an quote dot etc. (see perldoc 
perlre)

e.g.:

/\A<?local\.part+\@somedomain\.com>?\z/i

Note the \A anchor at the beginning of the regex:

\A is: Match only at beginning of string

Bye,

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJCCED5ThHZhj8SBwRAssxAJ45huNZBMqJk7hm6tiog8Wancr03QCfaQ14
HCV2v7auwQZ8NIswmt0WRME=
=5J50
-----END PGP SIGNATURE-----


More information about the MIMEDefang mailing list