On 04/02/2010 04:47 PM, Jared Williams wrote:
> Would make sense. Especially considering HTML5's current validation
> rules of emails is something different again.
> 
> http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-
> the-type-attribute.html#e-mail-state
> 
> Having a mismatch in validation between client & server just a recipe
> for user frustration. 

I actually think this regex is really close to the HTML5 specification.
 The main thing it drops are comments and folded whitespace, both of
which are not supported in this regex either.
That means addresses like the following will all fail even though they
are technically valid:

test
b...@example.com

(with a carriage return after test there)

(hey)rasmus(there)@(go)php.net(woo)

rasmus(Hey
guess what
this is a "valid"
email address)
@php.net

rasmus."ras...@php.net"@php.net

As far as I am concerned I am perfectly ok with rejecting addresses like
these and I think we should just stick to the HTML5 definition.

The ABNF for an HTML5 valid email field is:

  1*( atext / "." ) "@" ldh-str 1*( "." ldh-str )

which means there must be a . in the domain part, so HTML5 doesn't think
a...@b is valid either.  The left-hand side looks wrong though.  It seems
to me it should be:

  1*atext *("." 1*atext)

You can't have a trailing . there.  rasm...@php.net is not valid and if
I am reading that HTML5 ABNF correctly it would seem to allow that.

-Rasmus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to