title: Regex.Replace - pattern for correcting date format
body: <p>I am trying to format date entered by user. 
  Dates are provided in the following format:</p>
  
  <ul>
  <li>d/M/yyyy (ie: 1/1/2012, but could be also 12/1/2012 or 1/12/2012) </li>
  </ul>
  
  <p>however I need them converted to:</p>
  
  <ul>
  <li>dd/MM/yyyy (ie: 01/01/2012)</li>
  </ul>
  
  <p>I managed to do it in non-Regex way, like this:</p>
  
  <pre><code>    string date = "1/1/2012";
  
      if (date.IndexOf("/") == 1)
      {
          date = "0" + date;
      }
      if (date.Substring(4, 1) == "/")
      {
          date = date.Insert(3, "0");
      }
  </code></pre>
  
  <p>I would really like to know how to do it with Regex.Replace, however, as it would probably be neater.</p>
  
  <p>I tired different variations of the below: </p>
  
  <pre><code>    string date = "1/1/2012"
  
      date = Regex.Replace(date, @"\d{1}/", "0$&amp;");
  </code></pre>
  
  <p>The above will work, but if the date is 12/1/2012, it will also make 102 out of 12. If I add ^ at the beginning of pattern I don't get the second number changed. I also tried combinations with [^|/] at the beginning, but also no luck. So at the moment it is either or.</p>