You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2010/01/09 13:18:54 UTC

[jira] Issue Comment Edited: (LANG-397) RegexpUtils?

    [ https://issues.apache.org/jira/browse/LANG-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798340#action_12798340 ] 

Henri Yandell edited comment on LANG-397 at 1/9/10 12:17 PM:
-------------------------------------------------------------

Possible item of code. Useful in password strength testing (see: LANG-573):

    public static int countMatches(String text, String regex) {
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(text);
        int count = 0;
        while(m.find()) {
            count++;
        }
        return count;
    }

Overload, as I suspect all RegexUtils methods would be with Pattern. Alternative, per IO and File objects, don't support a String regex API.

      was (Author: bayard):
    Possible item of code. Useful in password strength testing (see: LANG-573):

    public static int countMatches(String text, String regex) {
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(text);
        int count = 0;
        while(m.find()) {
            count++;
        }
        return count;
    }
  
> RegexpUtils?
> ------------
>
>                 Key: LANG-397
>                 URL: https://issues.apache.org/jira/browse/LANG-397
>             Project: Commons Lang
>          Issue Type: Task
>          Components: lang.*
>            Reporter: Henri Yandell
>             Fix For: 3.x
>
>
> Consider whether we can add any value to the Regexp libraries.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.