The matches
method attempts to match the entire input sequence against the pattern. You should call Matcher.find()
in a loop until it returns false. Each time you call Matcher.find()
, you can access the group for the current found occurrence.
while (m.find()) {
String someGroup = m.group(1);
}