[ 
https://issues.apache.org/jira/browse/WW-3885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Uhlir updated WW-3885:
-----------------------------

    Description: 
EmailValidator documentation specifies following regular expression to validate 
email addresses:
{noformat}
\\b(^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@([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
{noformat}

but the actual implementation uses following regular expression:
{noformat}
\\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
{noformat}

which is wrong, because this email address "[email protected]" is being validated 
as a correct email address (I experience this issue in client side validation).

The (more?) correct regular expression should be probably the one specified in 
the documentation, but care needs to be taken of the apostrophe for the front 
part of the email address as well. The resulting regular expression might be 
something like this:
{noformat}
\\b(^['_A-Za-z0-9-]+(\\.['_A-Za-z0-9-]+)*@([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
{noformat}

  was:
EmailValidator documentation specifies following regular expression to validate 
email addresses:
\\b(^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@([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

but the actual implementation uses following regular expression:
\\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

which is wrong, because this email address "[email protected]" is being validated 
as a correct email address (I experience this issue in client side validation).

The (more?) correct regular expression should be probably the one specified in 
the documentation, but care needs to be taken of the apostrophe for the front 
part of the email address as well. The resulting regular expression might be 
something like this:

\\b(^['_A-Za-z0-9-]+(\\.['_A-Za-z0-9-]+)*@([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

    
> Invalid email address validation (client side). EmailValidator regex 
> implementation doesn't match documentation.
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3885
>                 URL: https://issues.apache.org/jira/browse/WW-3885
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors, Documentation
>    Affects Versions: 2.3.4.1
>            Reporter: Martin Uhlir
>              Labels: patch
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> EmailValidator documentation specifies following regular expression to 
> validate email addresses:
> {noformat}
> \\b(^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@([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
> {noformat}
> but the actual implementation uses following regular expression:
> {noformat}
> \\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
> {noformat}
> which is wrong, because this email address "[email protected]" is being 
> validated as a correct email address (I experience this issue in client side 
> validation).
> The (more?) correct regular expression should be probably the one specified 
> in the documentation, but care needs to be taken of the apostrophe for the 
> front part of the email address as well. The resulting regular expression 
> might be something like this:
> {noformat}
> \\b(^['_A-Za-z0-9-]+(\\.['_A-Za-z0-9-]+)*@([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
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to