title: Regex Pattern where group may not exist
body: <p>I have a RegEx pattern that needs to match on any of the following lines:</p>
  
  <pre><code>10-10-15 15:16:41.1 Some Text here 
  10-10-15 15:16:41.12 Some Text here 
  10-10-15 15:16:41.123 Some Text here 
  10-10-15 15:16:41 Some Text here 
  </code></pre>
  
  <p>I can match the first 3 with the pattern below:</p>
  
  <pre><code>(?&lt;date&gt;(?&lt;day&gt;\d{1,2})-(?&lt;month&gt;\d{1,2})-(?&lt;year&gt;(?:\d{4}|\d{2}))\s(?&lt;time&gt;(?&lt;hour&gt;\d{2}):(?&lt;minutes&gt;\d{2}):(?&lt;seconds&gt;\d{2})\.(?&lt;milli&gt;\d{0,3})))\s(?&lt;Line&gt;.*)
  </code></pre>
  
  <p>How do i Match this line (10-10-15 15:16:41 Some Text here) which has no milliseconds but still get the group back in my result either wit a blank value or with 0 as the value?</p>
  
  <p>Thanks</p>
  
  <p>As i said each of the lines below will match:</p>
  
  <pre><code>10-10-15 15:16:41.123 Some text Here
  10-10-15 15:16:41.12 Some Text here 
  10-10-15 15:16:41.1 Some Text here 
  10-10-15 15:16:41. Some Text here 
  </code></pre>
  
  <p>The groups look like so:</p>
  
  <pre><code>date    [0-18]  `10-10-15 15:16:41.`
  day     [0-2]   `10`
  month   [3-5]   `10`
  year    [6-8]   `15`
  time    [9-18]  `15:16:41.`
  hour    [9-11]  `15`
  minutes [12-14] `16`
  seconds [15-17] `41`
  milli   [18-18] ``
  Line    [19-34] `Some Text here `
  </code></pre>