title: java regex capture group
body: <p>I am trying to capture the right part after the : using java expr, but in the following code, the printed capture group is the whole string, what's wrong? </p>
  
  <pre><code>String s ="xyz: 123a-45";   
  String patternStr="xyz:[ \\t]*([\\S ]+)";
  Pattern p = Pattern.compile(patternStr);
  Matcher m = p.matcher(s);
  //System.err.println(s);
  if(m.find()){
      int count = m.groupCount();
      System.out.println("group count is "+count);
      for(int i=0;i&lt;count;i++){
          System.out.println(m.group(i));
      }
  }
  </code></pre>