commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (VALIDATOR-196) GenericValidator#matchRegexp
Date Fri, 14 Jul 2006 22:50:14 GMT
     [ http://issues.apache.org/jira/browse/VALIDATOR-196?page=all ]

Henri Yandell resolved VALIDATOR-196.
-------------------------------------

    Resolution: Invalid

The only Perl in there is that you do "m/...../"  or the shorthand of "/...../".

I don't see any obvious reason as to why you would need to put "//" around the regexp and
not just "/". Perl5Util's javadoc seems pretty clear that it's just the one "/".

The reporter's issue is INVALID. In regexp terms, "[a-zA-Z0-9]*" will always match the chosen
text "as*&^%dfasd1314213". Ignoring the lack of ^ and $, having a single token followed
by * will match anything, including an empty string as the * is zero-to-many and including
a string of "%%%%". Niall's suggestion is probably what you're after, but it'll all depend
on exactly what you want to do regexp-wise.

As it's the greatest computer book of all time, I heartily recommend Jeffrey Friedl's Mastering
Regular Expressions book :)

> 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