note 34927 deleted from function.ereg by irchtml
| From: | irchtml@php.net | Date: | Wed, 25 Feb 2004 17:31:15 +0000 |
| Subject: | note 34927 deleted from function.ereg by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65743@lists.php.net to get a copy of this message | ||
Note Submitter: tomasz@trejderowski.com
----
In addition to john dot winstanley at angelsolutions dot co dot uk:
Since we have a top-level domains (TLDs) like .aero, .info or even .museum, your e-mail validation
function:
eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $email)
won't work fine for all the e-mails available. The better solution is to let user enter not
only 2 or 3 letters after final dot but a top-level domain name in length from 2 to 6 characters. So
the correct e-mail validation function should be:
eregi("^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$", $email)
That works fine for me.