title: Validating date formats in rails
body: <p>My simple date validation regex is not working correctly...</p>
  
  <pre><code>validates_format_of :dob, :with =&gt; /\d{2}\/\d{2}\/\d{4}/, :message =&gt; "^Date must be in the following format: mm/dd/yyyy"
  </code></pre>
  
  <p>What am I missing here? I'm trying to validate that a date is in the following format: mm/dd/yyyy - When I enter what should be valid data, I still get the error message. </p>
  
  <p>Thanks for the help so far. Here's a snippet of code from my form that is passing the dob value in:</p>
  
  <pre><code>    &lt;tr&gt;        
        &lt;td&gt;
          &lt;%= f.label :dob, "Date of Birth:  " %&gt;
        &lt;/td&gt;
        &lt;td&gt;
          &lt;%= calendar_date_select_tag "user[dob]", "", :format =&gt; :american, :year_range =&gt; 50.years.ago..0.years.ago %&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
  </code></pre>
  
  <p>I think it may have something to do with my use of this js calendar plugin. A related problem is that my dob value is not maintained in the field if the post fails validation - the previously entered date value clears out... </p>
  
  <p>Thanks!</p>
  
  <p>Tom</p>