Email address check function

Gerrit Holl gerrit.holl at pobox.com
Thu Dec 2 14:59:32 EST 1999


Andrew M. Kuchling wrote:
> Gerrit Holl <gerrit.holl at pobox.com> writes:
> > I'm writing some CGI scripts and I want the user to fill in their real email
> > address. Checking this is more difficult than just look if it contains an '@'.
> 
> Definitely.  In _Mastering Regular Expressions_, Jeffrey Frield
> derives a regular expression for matching valid RFC-822 email
> addresses.  Perl versions can be downloaded from 
> http://public.yahoo.com/~jfriedl/regex/code.html.

Perl :-(... Well, I'll play with re.compile().

> The version in the PCRE test suite begins:
> 
> /[\040\t]*                    # Nab whitespace.
> (?:
> \(                              #  (
> [^\\\x80-\xff\n\015()] *                             #     normal*
> (?:                                 #       (
[cut]
> 
> ... and so on, lasting for 593 lines in all.

593 lines!? I think I'll be happy with the input some faster then, the
server it runs on has only 90 mHZ...

> But of course you can't
> verify an address like foo at bar.com without actually sending e-mail to
> it and seeing if it bounces.

Of course not. But people entering a wrong adres, just won't get answer. But
mail with an address not matching the above, sometimes bounces.

regards,
Gerrit.

-- 
"People get annoyed when you try to debug them."

  -- Larry Wall (Open Sources, 1999 O'Reilly and Associates)
  8:57pm  up  7:30, 14 users,  load average: 1.30, 1.23, 1.11




More information about the Python-list mailing list