title: regular expression for matching date in Perl
body: <p>I want to match dates that have the following format:</p>
  
  <pre><code>2010-08-27 02:11:36
  </code></pre>
  
  <p>i.e. <code>yyyy-mm-dd hh:mm:ss</code>.</p>
  
  <p>Right now I am not very particular about the date being actually feasible, but just that it is in the correct format.</p>
  
  <p>Possible formats that should match are (for this example)</p>
  
  <pre><code>2010
  2010-08
  2010-08-27
  2010-08-27 02
  2010-08-27 02:11
  2010-08-27 02:11:36
  </code></pre>
  
  <p>In Perl, what can be a concise regex for this?</p>
  
  <p>I have this so far (which works, btw)</p>
  
  <pre><code>/\d{4}(-\d{2}(-\d{2}( \d{2}(:\d{2}(:\d{2})?)?)?)?)?/
  </code></pre>
  
  <p><strong>Can this be improved performance-wise?</strong></p>