struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From " " <stoupa91de...@seznam.cz>
Subject Email validation regex - client vs. server
Date Sat, 06 Oct 2012 10:30:23 GMT
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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message