myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anita Anandan (JIRA)" <...@myfaces.apache.org>
Subject [jira] Created: (TRINIDAD-1181) The client side Regex validator needs to specify the start and end of the pattern
Date Fri, 15 Aug 2008 03:43:44 GMT
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.


Mime
View raw message