small change

Michael Chaney mdchaney at MICHAELCHANEY.COM
Thu May 9 22:09:52 IST 2002

>     s/^\*\.//; # and a "*." at the beginning of line
<     s/\s.*$//g; # Just use the first word
>     s/^([a-z0-9\-]+(?:\.[a-z0-9\-]+)+).*$/\1/i; # Just use the first domain

When using Exim, it's common to have a local domain map file, with
entries such as this:


So that if someone sends to mdchaney at, I still get
it.  That file is also my only list of domain names, and I don't want to
have to duplicate the data.

The above minor changes to will strip off any leading "*.",
and then grab only the first domain name on the line.  The old code just
cuts off the first space and everything after it; this code accomplishes
the same thing in the opposite manner, which is to simply grab the first
valid domain name on the line.  However, this is far more generalized
because it only looks for the first character which isn't valid in a
domain name (actually, it also does some minor validation of the domain
name, too).

Michael Darrin Chaney
mdchaney at

More information about the MailScanner mailing list