Hi all,
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).
This is the expressen:
/^\d[1-31]{2}\-\d[1-12]{2}\-\d[1900-2009]{4}$/
But I would like to have a dynamic regular expression like:
$yearSpan = (date("Y") - 110)."-".date("Y");
/^\d[1-31]{2}\-\d[1-12]{2}\-\d[$yearSpan]{4}$/
When I try to use this expression it keeps telling me the compilation failed because a range out of order in character class.
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.
Any suggestions?