title: PHP RegExp: Validate date (or "RegExp must match exactly")
body: <p>I want to match a date-format in PHP using a regular expression. To keep it simple, it can be extended later anyway, the regex should also match <code>2012-30-60</code> (which is not a valid date).</p>
  
  <p>My expression is the following: <code>"/\s*\d{4}-\d{2}-\d{2}\s*/i"</code>. Using <code>preg_match</code> works fine, but it also matches dates that have preceding and appending characters, like <code>"Hello 2012-09-01 Goodbye."</code></p>
  
  <p>How can I make the regex to match <strong>only</strong> when the expression matches <strong>the whole string</strong>?</p>