Simple date regexp problem
Posted: Tue Oct 02, 2007 4:37 pm
feyd | Please use
The problem is that this function always returns false. I only want it to return false if a date is NOT found. I know it must be something simple. Any help would be much appreciated. Also note that I commented out the line I wanted to use and used a less complicated regex so I could debug. Thanks again.
Ironosity[/b]
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
So here's my php function:Code: Select all
function valDate($date)
{
$valid = true;
echo "In Date = ".$date."<br />";
//if (!eregi("([1-9]|(0[1-9])|([1-2][0-9])|3[0-1])\/((0[1-9])|(1[0-2]))\/[0-9]{1,4}$", $date))
if(!eregi("\d{2}\/\d{2}\/\d{4}", $date))
{
$valid = false;
echo "valid after = ".$valid."<br/>";
}
return $valid;
}Ironosity[/b]
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]