note 34927 modified in function.ereg by vincent
| From: | vincent@php.net | Date: | Fri, 29 Aug 2003 07:43:47 +0000 |
| Subject: | note 34927 modified in function.ereg by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55279@lists.php.net to get a copy of this message | ||
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.
--was--
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-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email)
That works fine for me.
http://www.php.net/manual/en/function.ereg.php