I'm trying to validate dates like DD/MM/YYYY with PHP using preg_match(). This is what my REGEX expression looks like:
$pattern = "/^([123]0|[012][1-9]|31)/(0[1-9]|1[012])/(19[0-9]{2}|2[0-9]{3})$/";
But using it with a correct value, I get this message:
preg_match(): Unknown modifier '('
Complete code:
$pattern = "/^([123]0|[012][1-9]|31)/(0[1-9]|1[012])/(19[0-9]{2}|2[0-9]{3})$/";
$date = "01/03/2011";
if(preg_match($pattern, $date)) return TRUE;
Thank you in advance