You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by <st...@seznam.cz> on 2012/10/06 12:30:23 UTC

Email validation regex - client vs. server

Hi all,

I'm using @EmailValidator annotation to check an email address.
The Struts2 documentation http://struts.apache.org/2.x/docs/email-validator.
html(http://struts.apache.org/2.x/docs/email-validator.html) mentions that 
following regular expression is being used to check the email address:

\\b(^[_A-Za-z0-9-]<ins>(\\.[_A-Za-z0-9-]</ins>)*@([A-Za-z0-9-])+((\\.com)|(\\.net)|(\\.org)|(\\.info)|(\\.edu)|(\\.mil)|(\\.gov)|(\\.biz)|(\\.ws)|(\\.us)|(\\.tv)|(\\.cc)|(\\.aero)|(\\.arpa)|(\\.coop)|(\\.int)|(\\.jobs)|(\\.museum)|(\\.name)|(\\.pro)|(\\.travel)|(\\.nato)|(\\..{2,3})|(\\..{2,3}\\..{2,3}))$)\\b

I'm just wondering why following regular expression is actually being 
generated for the client side validation instead of the first one? (This is 
what I see in the generated HTML page)
/\b(^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\.[A-Za-z0-9-]+)*((\.
[A-Za-z0-9]{2,})|(\.[A-Za-z0-9]{2,}\.[A-Za-z0-9]{2,}))$)\b/gi

The reason why I ask this question is that the client side validation (using
the second reg ex) considers for example this address aaa@aa.aaaaaaa
(mailto:aaa@aa.aaaaaaa) as a valid email address.
Do I miss something or is it a bug?

Martin

Re: Email validation regex - client vs. server

Posted by stanilas <st...@yahoo.fr>.
maybe you have clean your cache browser

--- En date de : Dim 7.10.12, stoupa91devel [via Struts] <ml...@n5.nabble.com> a écrit :

De: stoupa91devel [via Struts] <ml...@n5.nabble.com>
Objet: Re: Email validation regex - client vs. server
À: "stanilas" <st...@yahoo.fr>
Date: Dimanche 7 octobre 2012, 13h20



	On 10/07/2012 02:27 AM, Lukasz Lenart wrote:

> 2012/10/6  <[hidden email]>:

>> Hi all,

>>

>> I'm using @EmailValidator annotation to check an email address.

>> The Struts2 documentation http://struts.apache.org/2.x/docs/email-validator.

>> html(http://struts.apache.org/2.x/docs/email-validator.html) mentions that

>> following regular expression is being used to check the email address:

>>

>> \\b(^[_A-Za-z0-9-]<ins>(\\.[_A-Za-z0-9-]</ins>)*@([A-Za-z0-9-])+((\\.com)|(\\.net)|(\\.org)|(\\.info)|(\\.edu)|(\\.mil)|(\\.gov)|(\\.biz)|(\\.ws)|(\\.us)|(\\.tv)|(\\.cc)|(\\.aero)|(\\.arpa)|(\\.coop)|(\\.int)|(\\.jobs)|(\\.museum)|(\\.name)|(\\.pro)|(\\.travel)|(\\.nato)|(\\..{2,3})|(\\..{2,3}\\..{2,3}))$)\\b

>>

>> I'm just wondering why following regular expression is actually being

>> generated for the client side validation instead of the first one? (This is

>> what I see in the generated HTML page)

>> /\b(^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\.[A-Za-z0-9-]+)*((\.

>> [A-Za-z0-9]{2,})|(\.[A-Za-z0-9]{2,}\.[A-Za-z0-9]{2,}))$)\b/gi

>>

>> The reason why I ask this question is that the client side validation (using

>> the second reg ex) considers for example this address [hidden email]

>> (mailto:[hidden email]) as a valid email address.

>> Do I miss something or is it a bug?

>>

>> Martin

> I think the docs are wrong, in code I see

>

> \\b(^['_A-Za-z0-9-]+(\\.['_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\\.[A-Za-z0-9-]+)*((\\.[A-Za-z0-9]{2,})|(\\.[A-Za-z0-9]{2,}\\.[A-Za-z0-9]{2,}))$)\\b

>

> So please register an issue

>

>

> Kind regards

Ok, issue registered https://issues.apache.org/jira/browse/WW-3885

Martin



	
	
	
	

	

	
	
		If you reply to this email, your message will be added to the discussion below:
		http://struts.1045723.n5.nabble.com/Email-validation-regex-client-vs-server-tp5710741p5710747.html
	
	
		To start a new topic under Struts - User, email ml-node+s1045723n3426046h55@n5.nabble.com 

		To unsubscribe from Struts - User, click here.

		NAML
	



--
View this message in context: http://struts.1045723.n5.nabble.com/Email-validation-regex-client-vs-server-tp5710741p5710748.html
Sent from the Struts - User mailing list archive at Nabble.com.

Re: Email validation regex - client vs. server

Posted by Martin Uhlir <st...@seznam.cz>.
On 10/07/2012 02:27 AM, Lukasz Lenart wrote:
> 2012/10/6  <st...@seznam.cz>:
>> Hi all,
>>
>> I'm using @EmailValidator annotation to check an email address.
>> The Struts2 documentation http://struts.apache.org/2.x/docs/email-validator.
>> html(http://struts.apache.org/2.x/docs/email-validator.html) mentions that
>> following regular expression is being used to check the email address:
>>
>> \\b(^[_A-Za-z0-9-]<ins>(\\.[_A-Za-z0-9-]</ins>)*@([A-Za-z0-9-])+((\\.com)|(\\.net)|(\\.org)|(\\.info)|(\\.edu)|(\\.mil)|(\\.gov)|(\\.biz)|(\\.ws)|(\\.us)|(\\.tv)|(\\.cc)|(\\.aero)|(\\.arpa)|(\\.coop)|(\\.int)|(\\.jobs)|(\\.museum)|(\\.name)|(\\.pro)|(\\.travel)|(\\.nato)|(\\..{2,3})|(\\..{2,3}\\..{2,3}))$)\\b
>>
>> I'm just wondering why following regular expression is actually being
>> generated for the client side validation instead of the first one? (This is
>> what I see in the generated HTML page)
>> /\b(^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\.[A-Za-z0-9-]+)*((\.
>> [A-Za-z0-9]{2,})|(\.[A-Za-z0-9]{2,}\.[A-Za-z0-9]{2,}))$)\b/gi
>>
>> The reason why I ask this question is that the client side validation (using
>> the second reg ex) considers for example this address aaa@aa.aaaaaaa
>> (mailto:aaa@aa.aaaaaaa) as a valid email address.
>> Do I miss something or is it a bug?
>>
>> Martin
> I think the docs are wrong, in code I see
>
> \\b(^['_A-Za-z0-9-]+(\\.['_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\\.[A-Za-z0-9-]+)*((\\.[A-Za-z0-9]{2,})|(\\.[A-Za-z0-9]{2,}\\.[A-Za-z0-9]{2,}))$)\\b
>
> So please register an issue
>
>
> Kind regards

Ok, issue registered https://issues.apache.org/jira/browse/WW-3885

Martin

Re: Email validation regex - client vs. server

Posted by Lukasz Lenart <lu...@apache.org>.
2012/10/6  <st...@seznam.cz>:
> Hi all,
>
> I'm using @EmailValidator annotation to check an email address.
> The Struts2 documentation http://struts.apache.org/2.x/docs/email-validator.
> html(http://struts.apache.org/2.x/docs/email-validator.html) mentions that
> following regular expression is being used to check the email address:
>
> \\b(^[_A-Za-z0-9-]<ins>(\\.[_A-Za-z0-9-]</ins>)*@([A-Za-z0-9-])+((\\.com)|(\\.net)|(\\.org)|(\\.info)|(\\.edu)|(\\.mil)|(\\.gov)|(\\.biz)|(\\.ws)|(\\.us)|(\\.tv)|(\\.cc)|(\\.aero)|(\\.arpa)|(\\.coop)|(\\.int)|(\\.jobs)|(\\.museum)|(\\.name)|(\\.pro)|(\\.travel)|(\\.nato)|(\\..{2,3})|(\\..{2,3}\\..{2,3}))$)\\b
>
> I'm just wondering why following regular expression is actually being
> generated for the client side validation instead of the first one? (This is
> what I see in the generated HTML page)
> /\b(^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\.[A-Za-z0-9-]+)*((\.
> [A-Za-z0-9]{2,})|(\.[A-Za-z0-9]{2,}\.[A-Za-z0-9]{2,}))$)\b/gi
>
> The reason why I ask this question is that the client side validation (using
> the second reg ex) considers for example this address aaa@aa.aaaaaaa
> (mailto:aaa@aa.aaaaaaa) as a valid email address.
> Do I miss something or is it a bug?
>
> Martin

I think the docs are wrong, in code I see

\\b(^['_A-Za-z0-9-]+(\\.['_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\\.[A-Za-z0-9-]+)*((\\.[A-Za-z0-9]{2,})|(\\.[A-Za-z0-9]{2,}\\.[A-Za-z0-9]{2,}))$)\\b

So please register an issue


Kind regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org