Re: Regex validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ceo wrote:>var_dump(imap_rfc822_parse_adrlist('"! # $ % &  * + - / = ? ^ _ ` { | } ~"', ''));>This looks like a valid localhost email address to me...
It surely is a valid localhost email address, but what most people(and the OP) usually need is to validate a full email string with alocal and a domain part.
What should be valid email addresses according to RFC 2822 [1]:!#$%&*+-/=?^_`{|}~@example.com"@"@example.com
Not valid email addresses:"\"@example.com@@example.com- -@xxxxxxxxxxx
Valid email addresses according to the Multipurpose Internet MailExtension (MIME) [2]:ä@example.comé@℞.com
So for people who got to write code that also works on PHP4 it is notvery easy to validate an email address.Even nice regex attempts like [3] fail since more and more mailservers support the MIME hieroglyphs.That's why I was pretty excited about imap_rfc822_parse_adrlist(),since it runs in PHP4 if installed.Which clearly is no substitute for the PHP5+ filter functions [4].If it's just my brain farting and there actually then tell me.
[1] http://www.faqs.org/rfcs/rfc2822.html[2] http://en.wikipedia.org/wiki/MIME[3] http://www.addedbytes.com/php/email-address-validation/[4] http://in.php.net/filter

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux