[
https://issues.apache.org/jira/browse/TRINIDAD-1181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12622819#action_12622819
]
Anita Anandan commented on TRINIDAD-1181:
-----------------------------------------
Tested the patch with the following
(1) Pattern is [1-9]|[1-9][0-9]|[1-9][0-9][0-9]
(a) inputs 9, 99, 999 - all are matched
(b) input 9999 - not matched
(2) Pattern is [1-9][0-9][0-9]|[1-9][0-9]|[1-9]
(a) inputs 9, 99, 999 - all are matched
(b) input 9999 - not matched
(3) Pattern is ^([1-9]|[1-9][0-9]|[1-9][0-9][0-9])$
(a) inputs 9, 99, 999 - all are matched
(b) input 9999 - not matched
(4) Pattern is ^([1-9][0-9][0-9]|[1-9][0-9]|[1-9])$
(a) inputs 9, 99, 999 - all are matched
(b) input 9999 - not matched
Also, tested that the error message only refers to the original pattern, not
the modified one (with ^ and $)
> The client side Regex validator needs to specify the start and end of the
> pattern
> ---------------------------------------------------------------------------------
>
> Key: TRINIDAD-1181
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1181
> Project: MyFaces Trinidad
> Issue Type: Bug
> Environment: Windows XP
> Reporter: Anita Anandan
> Priority: Minor
>
> The following pattern should match numbers 1-999:
> "[1-9]|[1-9][0-9]|[1-9][0-9][0-9]". Granted there are better ways of
> specifying the regex for numbers 1-999. Still this pattern should match
> numbers 1-999. In reality the client side validation only matches numbers 1-9.
> Note that the reverse pattern, i.e. "[1-9][0-9][0-9]|[1-9][0-9]|[1-9]"
> matches numbers 1-999. Also note that the server side Java Regex Validator
> works as expected, matching both the pattern and the reversed pattern to
> numbers 1-999.
> The reason the 10-999 is not matched by JavaScript to
> "[1-9]|[1-9][0-9]|[1-9][0-9][0-9]" is that the first digit always matches. So
> it doesn't need to go down the chain. In order to indicate to force it to do
> so, we need to ground the start and end, and include the pattern in
> parenthesis. i.e. We need the pattern to be
> "^([1-9]|[1-9][0-9]|[1-9][0-9][0-9])$".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.