On 10/23/05, Manuel Lemos <mlemos@xxxxxxx> wrote: > Hello, > > > on 10/22/2005 12:58 AM Richard Lynch said the following: > > Checking MX records is not reliable at all. > > I agree that it is less useful today, but it still help catches many > domain name typos. > > > > ... would it not make sense for there to be a BUILT-IN PHP function of > > a TRUE email syntactic validation? > > I don't see that being much better than passing a good regular > expression to preg_match. 1. Technically you can't write a regular expression that matches *all* valid email addresses as part of the address specification is recursive. ccontent = ctext / quoted-pair / comment comment = "(" *([FWS] ccontent) [FWS] ")" Admittedly 99.99% of people don't even know you *can* comment email addresses so it's not a huge problem... 2. Very few people seem to be capable of recognising a *good* regular expression, let alone writing one. It seems clear that validating an address is a task that many people want to do, but few can do properly. I'd say that's a good reason for making it a built-in function. > > For many years I use this regular expression in popular email validation > and forms generation and validation classes. > > > Rather than accepting only valid characters, it rejects all invalid > characters as specified in the RFC. > > ^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,6}$ > I'm sorry, but this regular expression rejects many perfectly valid ASCII characters. It seems to take into account only dot-atoms, not quoted-strings. It also rejects valid addresses using domain-literals. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php