Re: Select all invalid e-mail addresses
От | Steve Atkins |
---|---|
Тема | Re: Select all invalid e-mail addresses |
Дата | |
Msg-id | 20051020193439.GA32591@gp.word-to-the-wise.com обсуждение исходный текст |
Ответ на | Re: Select all invalid e-mail addresses (Andrew Sullivan <ajs@crankycanuck.ca>) |
Ответы |
Re: Select all invalid e-mail addresses
|
Список | pgsql-general |
On Thu, Oct 20, 2005 at 11:52:40AM -0400, Andrew Sullivan wrote: > 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. You need to maintain the data, certainly. To argue that it must be in a table to be maintained is, well, wrong. My preference would be to keep it in a table and regenerate the regex periodically, and in the application layer I do exactly that, but to try and do that in a check constraint would be painful. A cleaner approach would be to have a regex that checks for general syntax and extracts the TLD, which is then compared to a lookup table, perhaps, but that adds a lot of complexity for no real benefit. > (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.) While there are valid deliverable email addresses in .arpa, you really don't want to be accepting them from end users... Cheers, Steve
В списке pgsql-general по дате отправления: