Re: Select all invalid e-mail addresses - Mailing list pgsql-general

From Andrew Sullivan
Subject Re: Select all invalid e-mail addresses
Date
Msg-id 20051020155240.GD9291@phlogiston.dyndns.org
Whole thread Raw
In response to Re: Select all invalid e-mail addresses  ("Andrus" <eetasoft@online.ee>)
Responses Re: Select all invalid e-mail addresses
List pgsql-general
On Thu, Oct 20, 2005 at 06:10:40PM +0300, Andrus wrote:
> >From this thread I got the regular expression

[snipped]

Note that that regular expression, which appears to be validating
TLDs as well, is incredibly fragile.  John Klensin has actually
written an RFC about this very problem.  Among other problems, what
do you do when a country code ceases to be?  (There's a similar
problem that the naming bodies struggke with from time to time.)

I suggest that if you want to validate TLDs, you pull them off when
you write the data in your database, and use a lookup table to make
sure they're valid (you can keep the table up to date regularly by
checking the official IANA registry for them).  At least that way you
don't have to change a regex every time ICANN decides to add another
TLD.  (The regex is wrong anyway, I think: it doesn't have .mobi,
which has been announced although isn't taking registrations yet, and
it doesn't appear to have arpa, either.)

A


--
Andrew Sullivan  | ajs@crankycanuck.ca
Information security isn't a technological problem.  It's an economics
problem.
        --Bruce Schneier

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: 3-state logic (was: Re: NULL != text ?)
Next
From: Andrew Sullivan
Date:
Subject: Re: Select all invalid e-mail addresses