On 10/07/2012 02:27 AM, Lukasz Lenart wrote:
2012/10/6 <stoupa91de...@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