Re: Poll of sorts: Javascript Form validation or PHP
| From: | Yeti | Date: | Sun, 07 Dec 2008 10:27:52 +0000 |
| Subject: | Re: Poll of sorts: Javascript Form validation or PHP | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-284248@lists.php.net to get a copy of this message | ||
> I put a small one together using regular expressions,
> http://www.ashleysheridan.co.uk/coding_php_validation.php
So we are "regexing" emails again?
#OUT OF coding_php_validation.php COPY
case 'email':
{
$expression = "/^([a-z0-9_\-\.]+)@([a-z0-9_\-\.]+)\.([a-z]{2,5})$/i";
$errorText = "The email does not appear to be a valid type.";
break;
}
#END COPY
What should be valid email addresses according to RFC 2822 [1]:
!#$%&*+-/=?^_`{|}~@example.com
"@"@example.com
Not valid email addresses:
"\"@example.com
@@example.com
- -@example.com
Valid email addresses according to the Multipurpose Internet Mail
Extension (MIME) [2]:
ä@example.com
Ã(c)@℞.com