Don't use regular expressions to "validate" email addresses (was: I need some help with a regexp please)

Ant antroy at gmail.com
Fri Sep 22 04:58:24 EDT 2006


Ben Finney wrote:
...
> The best advice I've seen when people ask "How do I validate whether
> an email address is valid?" was "Try sending mail to it".

There are advantages to the regex method. It is faster than sending an
email and getting a positive or negative return code. The delay may not
be acceptable in many applications. Secondly, the false negatives found
by a reasonable regex will be few compared to the number you'd get if
the smtp server went down, or a remote relay was having problems
delivering the message etc etc.

>From a business point of view, it is probably more important to reduce
the number of false negatives than to reduce the number of false
positives - every false negative is a potential loss of a customer.
False positives? Who cares really as long as they are paying ;-)




More information about the Python-list mailing list