title: How to get a capture group that doesnt always exist?
body: <p>I have a regex something like   </p>
  
  <pre><code>(\d\d\d)(\d\d\d)(\.\d\d){0,1}
  </code></pre>
  
  <p>when it matches I can easily get first two groups, but how do I check if third occurred 0 or 1 times. </p>
  
  <p>Also another minor question: in the <code>(\.\d\d)</code> I only care about <code>\d\d</code> part, any other way to tell regex that <code>\.\d\d</code>  needs to appear 0 or 1 times, but that I want to capture only <code>\d\d</code> part ?</p>
  
  <p>This was based on a problem of parsing a </p>
  
  <blockquote>
    <p>hhmmss</p>
  </blockquote>
  
  <p>string that has optional decimal part for seconds( so it becomes </p>
  
  <blockquote>
    <p>hhmmss.ss</p>
  </blockquote>
  
  <p>)... I put <code>\d\d\d</code> in the question so it is clear about what <code>\d\d</code> Im talking about. </p>