Re: Poll of sorts: Javascript Form validation or PHP

From: Date: Sun, 07 Dec 2008 13:28:30 +0000
Subject: Re: Poll of sorts: Javascript Form validation or PHP
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-284252@lists.php.net to get a copy of this message
On Sun, 2008-12-07 at 02:27 -0800, Yeti wrote: > > 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 Yes, I know I'm going to hell, but it serves well for most purposes. In the future when I actually see people use those kind of email addresses then I'll update it. Ash www.ashleysheridan.co.uk

« previous php.general (#284252) next »