Use Matcher#matches or Matcher#find prior to invoking Matcher.group(int)
if (m.find()) {
System.out.println("group 1: " +m.group(1));
}
In this case Matcher#find is more appropriate as Matcher#matches matches the complete String (making the anchor characters redundant in the matching expression)