dimanche 24 juillet 2016

Regular expression not showing a match in Java [on hold]

I am trying to use regex with this specific pattern [1-9]00[1-9]00 on this test string:

010002001010002001010002001010002001010002001010004003010004003180

It isn't not finding any matches. Can anyone explain why?

When I run the match code on this string with [1-9]00, matcher.find() yields true and count increments.

Here is my code:

private static int  CheckforRegexMatches(String inputstring, String regexpattern) {
    Pattern pattern = Pattern.compile(regexpattern);
    Matcher matcher = pattern.matcher(Factor);

    int count = 0;
    while (matcher.find()) {
        count++;
    }
    //...
}

Aucun commentaire:

Enregistrer un commentaire