title: Regex with non-capturing group in C#
body: <p>I am using the following Regex</p>
  
  <pre><code>JOINTS.*\s*(?:(\d*\s*\S*\s*\S*\s*\S*)\r\n\s*)*
  </code></pre>
  
  <p>on the following type of data:</p>
  
  <pre><code> JOINTS               DISPL.-X               DISPL.-Y               ROTATION
  
  
       1            0.000000E+00           0.975415E+01           0.616921E+01
       2            0.000000E+00           0.000000E+00           0.000000E+00
  </code></pre>
  
  <p>The idea is to extract two groups, each containing a line (starting with the Joint Number, 1, 2, etc.) The C# code is as follows:</p>
  
  <pre><code>string jointPattern = @"JOINTS.*\s*(?:(\d*\s*\S*\s*\S*\s*\S*)\r\n\s*)*";
  MatchCollection mc = Regex.Matches(outFileSection, jointPattern );
  foreach (Capture c in mc[0].Captures)
  {
      JointOutput j = new JointOutput();
      string[] vals = c.Value.Split();
      j.Joint = int.Parse(vals[0]) - 1;
      j.XDisplacement = float.Parse(vals[1]);
      j.YDisplacement = float.Parse(vals[2]);
      j.Rotation = float.Parse(vals[3]);
      joints.Add(j);
  }
  </code></pre>
  
  <p>However, this does not work: rather than returning two captured groups (the inside group), it returns one group: the entire block, including the column headers. Why does this happen? Does C# deal with un-captured groups differently?</p>
  
  <p>Finally, are RegExes the best way to do this? (I really do feel like I have two problems now.)</p>