Validating Date
Posted: Tue Jul 26, 2005 6:06 am
Hello all,
Just need a little help on reg expressions, I'm still new to this and I'm totally confused.
I want to validate a date, it has to be in the format MM/DD/YYYY.
This is what I have initially, seems to work fine.
But when I tried to limit the month range to 1-12, it failed
What's the correct way to limit the month values to 01-12?
Just need a little help on reg expressions, I'm still new to this and I'm totally confused.
I want to validate a date, it has to be in the format MM/DD/YYYY.
This is what I have initially, seems to work fine.
Code: Select all
preg_match("#\d{2}/\d{2}/\d{4}#", '06/25/2005')Code: Select all
preg_match("#\d[1-12]{2}/\d{2}/\d{4}#", '06/25/2005')