title: Java Regex: matches(pattern, value) returns true but group() fails to match
body: <p>I have an odd problem with a regular expression in Java. I tested my Regex and my value <a href="http://www.regexplanet.com/simple/index.html" rel="noreferrer">here</a> and it works. It says there are 3 groups (correct) the match for the first group (not group zero!) is SSS, the match for group 2 is BB and the match for group 3 is 0000.  But my code below fails and I am quite at a loss why...</p>
  
  <pre><code>String pattern = "([^-]*)-([\\D]*)([\\d]*)";
  String value = "SSS-BB0000";
  Matcher matcher = Pattern.compile(pattern).matcher(value);
  //group() is equivalent to group(0) - it fails to match though
  matcher.group();
  </code></pre>
  
  <p>Here is a screenshot from the matching result of the above website:
  <img src="https://i.stack.imgur.com/64Ure.png" alt="enter image description here"></p>
  
  <p>I'd be really grateful if anyone could point out the mistake I am making... On an additional note: Strangely enough, if I execute the following code true is returned which implies a match should be possible...</p>
  
  <pre><code>//returns true
  Pattern.matches(pattern, value);
  </code></pre>