commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (VALIDATOR-196) GenericValidator#matchRegexp
Date Fri, 14 Jul 2006 12:46:15 GMT
    [ http://issues.apache.org/jira/browse/VALIDATOR-196?page=comments#action_12421107 ] 
            
Niall Pemberton commented on VALIDATOR-196:
-------------------------------------------

I don't think its the "/" characters you're missing - you need to put the start/end line boundary
matchers (that is ^ and $) for ORO - otherwise it validates that "any of those characters
are present" rather than "only those characters are present". Try the following:

GenericValidator.matchRegexp("as*&^%dfasd1314213","^[a-zA-Z0-9]*$"); 

As Gabriel said were planning to make the minimum dependency JDK 1.4 and use its built in
regexp support and remove the ORO dependency. I had a look at doing this recently - it would
be pretty straight forward except for one place in the EmailValidator that uses some perl
specific syntax to remove comments:

http://jakarta.apache.org/commons/validator/xref/org/apache/commons/validator/EmailValidator.html#244

First I need to get my head round what exactly that is doing (I don't know perl) before working
out how to replace it.

> GenericValidator#matchRegexp
> ----------------------------
>
>                 Key: VALIDATOR-196
>                 URL: http://issues.apache.org/jira/browse/VALIDATOR-196
>             Project: Commons Validator
>          Issue Type: Bug
>    Affects Versions: 1.3.1
>         Environment: Windows 2000 ; J2SDK 1.4.2 ; Eclipse 3.1.2
>            Reporter: lutianxiang
>
> GenericValidator.matchRegexp("as*&^%dfasd1314213","[a-zA-Z0-9]*");
> User this method cannot get FALSE value
> In this method Source like this...
> .........
> return matcher.match("/" + regexp + "/", value);
> should be 
> ..........
> return matcher.match("//" + regexp + "//", value);

-- 
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message