title: PHP Dynamic Regular expression?
body: <p>I'm relativly new to regular expressions but I managed to create a working expression to validate dates (without leap years, and assuming people enter a valid 30 or 31 digit for a month).</p>
  
  <p>This is the expressen:
  <code>/^\d[1-31]{2}\-\d[1-12]{2}\-\d[1900-2009]{4}$/</code></p>
  
  <p>But I would like to have a dynamic regular expression like:</p>
  
  <pre><code>$yearSpan = (date("Y") - 110)."-".date("Y");
  /^\d[1-31]{2}\-\d[1-12]{2}\-\d[$yearSpan]{4}$/
  </code></pre>
  
  <p>When I try to use this expression it keeps telling me the compilation failed because a range out of order in character class.</p>
  
  <p>I'm using this expression to validate dates of birth, and it would be nice not to update it every time a year passes by.</p>
  
  <p>Any suggestions?</p>