title: C++ regex: Which group matched?
body: <p>I have a regex containig various sub-groups which are connected through an or condition:</p>
  
  <pre><code>([[:alpha:]]+)|([[:digit:]]+)
  </code></pre>
  
  <p>When I match the string <code>1 a 2</code>, I get three matches: <code>1</code>, <code>a</code> and <code>2</code>.</p>
  
  <p>Is there a way in C++ to determine which of the sub-patterns matched?</p>