Your question is very common.
There currently is no way to get the intermediate
matches, you get only the last one. But in your example you even wouldn't need it, just remove the last quantifier and iterate through the matches using while(find()){...}.
As for groups() it just returns the contents of all groups of a pattern.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Named groups is a very good way to retrieve differents elements in a difficult regexpr.
But is there a way to retrieve multiple named groups :
I'd like to use a regexpr like this (mine in fact is more complex) :
({PAGE}\\d+)\\s?;?)+
against a text like :
"10 ; 20 ; 30 ; 40"
I use
match.group("PAGE");
but this syntax enables me to retrieve only the first
item.
There's no desription about this function :
String[] group(String);
Any idea ?
Thanks
LudoO
Your question is very common.
There currently is no way to get the intermediate
matches, you get only the last one. But in your example you even wouldn't need it, just remove the last quantifier and iterate through the matches using while(find()){...}.
As for groups() it just returns the contents of all groups of a pattern.