Hi, all!
I've got a text field in my DB, and inside it i have several date formmated like "02/02/2001". I need to find, from all the found dates, which one is the newest. I thought using regex 'd be nice, am i right?
Googlin, i've found http://www.roscripts.com/PHP_regular_expressions_examples-136.html, which lead me using something like:
function do_reg($text, $regex)
{
preg_match_all($regex, $text, $result, PREG_PATTERN_ORDER);
for ($i = 0; $i < count($result[0]); $i++) {
$result[0][$i];
}
}
But the given expressions are for cheking if there is any invalid date:
//Date yyyy-mm-dd
//1900-01-01 through 2099-12-31
//Matches invalid dates such as February 31st
'(19|20)[0-9]{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])'
So, anyone?
P.s.: this is because i'm importing a full-messed 'DB'.
Thanks!