jakarta-oro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From victor.vo...@gmxpro.net
Subject group(i) returning null for nested group
Date Sun, 23 Feb 2003 22:25:53 GMT
Hi,

I have a problem with the following pattern:

        Pattern pattern = p5compiler.compile("(A)(B)((C)(D))+");
        Perl5Matcher p5matcher = new Perl5Matcher();
        p5matcher.setMultiline(true);
        if ( p5matcher.contains("ABCDE", pattern) ) {
            MatchResult result = p5matcher.getMatch();
            for ( int i = 0; i < result.groups(); i++) {
            System.out.println("" + i + ": " + result.group(i));
            }
        }

The output will be 

    0: ABCD
    1: A
    2: B
    3: 
    4: null
    5: D

Why is the 4th line: "4: null" and not "4: C" as I would have expected?

Regards
Victor


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


Mime
View raw message