title: Regex backreferencing for month, day, and year?
body: <p>I am using a regex statement to match a date in a filename. I would like to break the output into groups (Which my statement does).</p>
  
  <p>I have tested the output so far but I cannot seem to get my group values to pass to a string so that I can create directories with them. Matter of fact I cant seem to get my group values at all.</p>
  
  <p>I understand that this could be done without regex but I opted to go this way to try and learn it. My input string is a filename <code>"Result5_14_20009 1_30_00 PM.xml"</code></p>
  
  <p>How can I create a string <code>"month"</code> where I pass the value to group 1, etc.?</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>private void btnSort_Click(object sender, EventArgs e)
  {
      string fileName = "Result*.xml";
      string sourcePath = txtSource.Text;
      string targetPath = txtDest.Text;
  
      //Get Data from Filename
      string[] files = System.IO.Directory.GetFiles(sourcePath);
      Regex date = new Regex(@"([1-9]|[0-2])_(\d{2})_(\d{4})", RegexOptions.CultureInvariant);
  
      foreach (string s in files)
      {
          Match m = date.Match(s);
          if (m.Success)
          {
              //Pass Groups to String
  
              //Create Dir for Group 3 (Year) 
              //Create Dir for Group 1 (Month)
              //Create Dir for Group 2 (Day)
          }
      }
  }
  </code></pre>