You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org> on 2006/02/05 03:39:26 UTC

[jira] Updated: (TAPESTRY-858) validators:pattern= does not support useful regex patterns

     [ http://issues.apache.org/jira/browse/TAPESTRY-858?page=all ]

Howard M. Lewis Ship updated TAPESTRY-858:
------------------------------------------

        type: Wish  (was: Bug)
    Priority: Minor  (was: Major)

This is specifically why I introduced the $bean syntax, since it gives
you a much cleaner way to specify these complex expressions.

In fact, I usually define a <bean>, and use message: binding prefixes
to allow me to store the actually regexp in a properties file.

> validators:pattern=<somepattern>   does not support useful regex patterns
> -------------------------------------------------------------------------
>
>          Key: TAPESTRY-858
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-858
>      Project: Tapestry
>         Type: Wish
>   Components: Framework
>     Versions: 4.0
>  Environment: All
>     Reporter: Sean Scott
>     Priority: Minor

>
> ValidatorFactoryImpl.constructValidatorList   uses a regular expression to parse the validators configuration string.  The configuration string can contain the type pattern=<some regular expression>.  If the regular expression contains a [ character (like most do) then the validators string is not processed correctly.
> Currently:
>     private static final String PATTERN = "^\\s*(\\$?\\w+)\\s*(=\\s*(((?!,|\\[).)*))?";
> Perhaps it can be changed so that the regex has start with ^ and end with $ and thus maybe a PATTERN like
> ^\s*(\$?\w+)\s*(=(\^.*\$)|(\s*(((?!,|\[).)*)))?
> can be used.
> To test, try using this value
> validators="validators:required,pattern=(0[1-9]|1[012])/(0[1-9]|[12][0-9]|3[01])/(19|20)\d\d"
> (mm/dd/yyyy)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org