> ...

Hi,

Had to have a play with this. Here's my (somewhat stricter) regex:

preg_match('/((?:[0-3]?[0-9])?\d)-([0-1]?\d)-20\d\d/', '31-12-2000', $matches);
if (!empty($matches[1]) AND $matches[1] > 31) $matches = array();
if (!empty($matches[2]) AND $matches[2] > 12) $matches = array();

You could probably do the checks for the day and month within the
regex, but it's late :-)

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to