title: Need a regex pattern to match date with optional time
body: <p><strong>I need a regex pattern which matches a date with optional time.</strong></p>
  
  <p>The date should be a valid U.S. date in <code>m/d/yyyy</code> format.  The time should be <code>h:mm:ss am/pm</code> or 24-hour time <code>hh:mm:ss</code>.</p>
  
  <blockquote>
    <p>Matches:  9/1/2011 | 9/1/2011 10:00 am | 9/1/2011 10:00 AM | 9/1/2011 10:00:00</p>
  </blockquote>
  
  <p>This pattern will be used in a Ruby on Rails project, so it should be in a format usable via Ruby.  See <a href="http://rubular.com/" rel="nofollow">http://rubular.com/</a> for testing.</p>
  
  <p>Here's my existing date pattern (which may be an over-kill):</p>
  
  <pre><code>DATE_PATTERN = /^((((0[13578])|([13578])|(1[02]))[\/](([1-9])|([0-2][0-9])|(3[01])))|(((0[469])|([469])|(11))[\/](([1-9])|([0-2][0-9])|(30)))|((2|02)[\/](([1-9])|([0-2][0-9]))))[\/]\d{4}$|^\d{4}/
  </code></pre>