You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-dev@jakarta.apache.org by Anakreon Mejdi <am...@ertonline.gr> on 2003/04/21 16:58:32 UTC

Re: group(i) returning null for nested group

dfs@savarese.org wrote:
> In message <3E...@ertonline.gr>, Anakreon Mejdi writes:
> 
>>I found the same problem too.
> 
> 
> 1. Don't send me personal emails.  Direct emails like this to
>    oro-dev@jakarta.apache.org.
Sorry.
I am not subscribed to the list.
I Used the mail archive to check about the
problem

> 2. This problem was fixed a while ago.  Use the latest CVS checkout.
> 
Version 2.0.7 did not work.
Because of firewall I can't use CVS.
However I downloaded via html CVS (I think this is how it is named)
the files which were at most 3 months old.
It still doesn't work properly.

Here  are some tests I did to verify if it is a bug:

Reg Exp:\s*(\d{1,2})\.(\d{1,2})(-(\d{1,2})\.(\d{1,2}))*(μμ|πμ)
Input: 7.00-9.00-11.00μμ

The output of matchResultExample is:
java -cp classes matchResultExample 
"\s*(\d{1,2})\.(\d{1,2})(-(\d{1,2})\.(\d{1,2}))*(μμ|πμ)" " 
7.00-9.00-11.00μμ"

Match:  7.00-9.00-11.00μμ
Length: 18
Groups: 7
Begin offset: 0
End offset: 18
Groups:
1: 7
Begin: 1
End: 2
2: 00
Begin: 3
End: 5
3: -11.00
Begin: 10
End: 16
4: 11
Begin: 11
End: 13
5: 00
Begin: 14
End: 16
6: μμ
Begin: 16
End: 18

The -9.00 is lost and -11.00 exists in three different groups.

If I tried input: 7.00-9.00-11.00-12.30μμ
The result is:
Match:  7.00-9.00-11.00-12.30μμ
Length: 24
Groups: 7
Begin offset: 0
End offset: 24
Groups:
1: 7
Begin: 1
End: 2
2: 00
Begin: 3
End: 5
3: -12.30
Begin: 16
End: 22
4: 12
Begin: 17
End: 19
5: 30
Begin: 20
End: 22
6: μμ
Begin: 22
End: 24

All the matches except the last one are lost in the 3 group.

As a workaround I used this pattern:
\s*(\d{1,2})\.(\d{1,2})((-\d{1,2}\.\d{1,2})*)(μμ|πμ)
group 3 will have in the above example string:-9.00-11.00-12.30
The String of the third group is sliced by an other regular expression.





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