title: regex to read space delimited values in c#
body: <p>code sample:</p>
  
  <pre><code>                string flowValues = @"(?&lt;day&gt;\d{2})\s+(?&lt;val1&gt;(\d+\.?\d+)|\w+)\s+(?&lt;val2&gt;(\d+\.?\d+)|\w+)?\s+(?&lt;val3&gt;(\d+\.?\d+)|\w+)\s+(?&lt;val4&gt;(\d+\.?\d+)|\w+)?\s+(?&lt;val5&gt;(\d+\.?\d+)|\w+)\s+(?&lt;val6&gt;(\d+\.?\d+)|\w+)?\s+(?&lt;val7&gt;(\d+\.?\d+)|\w+)\s+(?&lt;val8&gt;(\d+\.?\d+)|\w+)\s+(?&lt;val9&gt;(\d+\.?\d+)|\w+)?\s+(?&lt;val10&gt;(\d+\.?\d+)|\w+)\s+(?&lt;val11&gt;(\d+\.?\d+)|\w+)?\s+(?&lt;val12&gt;(\d+\.?\d+)|\w+)";
                  regex = new Regex(flowValues, regexOptions);
                  inputData = "30     64.0          96.6    101    172    258    647    612    599    184   74.8   63.0";//fileContents[10 + i];
                  match = regex.Match(inputData);
                  dataMatrix[i, 0] = match.Groups["val1"].Value;
                  dataMatrix[i, 1] = match.Groups["val2"].Value;
                  dataMatrix[i, 2] = match.Groups["val3"].Value;
                  dataMatrix[i, 3] = match.Groups["val4"].Value;
                  dataMatrix[i, 4] = match.Groups["val5"].Value;
                  dataMatrix[i, 5] = match.Groups["val6"].Value;
                  dataMatrix[i, 6] = match.Groups["val7"].Value;
                  dataMatrix[i, 7] = match.Groups["val8"].Value;
                  dataMatrix[i, 8] = match.Groups["val9"].Value;
                  dataMatrix[i, 9] = match.Groups["val10"].Value;
                  dataMatrix[i, 10] = match.Groups["val11"].Value;
                  dataMatrix[i, 11] = match.Groups["val12"].Value;
  </code></pre>
  
  <p>Here, the value returned by<code>match.Groups["val2"].Value;</code> is 96.6 while I expected it to return empty string whereas <code>match.Groups["val11"].Value;</code> is empty while I expected it to return 74.8.</p>
  
  <p>The input data are some flow values for corresponding days in each month. So:
  <img src="https://i.stack.imgur.com/qCMrk.png" alt="enter image description here">
  Note that these values are for 2008. So we have a value for 29th Feb.</p>