Hi,
Say, I have a regexp like (\d)(?:,(\d))* which recognizes inputs like
"1", "0,4", "9,2,0", etc. What I want is to get all captured strings
from group 3 (and also the one from group 1). When the operation has
finished group 3 has only the last captured text which is the last
digit for this case. However I want to get all digits matched by group
1 and 3.
This is stated in API doc as follows:
"The captured input associated with a group is always the subsequence
that the group most recently matched. If a group is evaluated a second
time because of quantification then its previously-captured value, if
any, will be retained if the second evaluation fails. Matching the
string "aba" against the expression (a(b)?)+, for example, leaves group
two set to "b". All captured input is discarded at the beginning of
each match."
(
http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html#cg
)
You may advise to use splitting but it does not work for more complex
examples where delimitors are also included in the subgroups several
times.
Any suggestions?
Thanks in advance.
-- Ersin
Ersin Er - 03 Oct 2005 09:23 GMT
In fact, .NET CaptureCollection is what I really want.
It's explained here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
concomregularexpressions.asp
Isn't it possible for Java ?

Signature
Ersin
Ersin Er - 03 Oct 2005 09:25 GMT
> In fact, .NET CaptureCollection is what I really want.
>
> It's explained here:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
concomregularexpressions.asp
Sorry, here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conusingregularexpressionclasses.asp
> Isn't it possible for Java ?
HGA03630@nifty.ne.jp - 03 Oct 2005 11:11 GMT
OP is confusing a sub-expression with an independant principal
expression.
MHO tells that this discussion thread should be aborted.