REGEX for mm/dd/yyyy

Hi,
Does anyone have a simple regex to just verify "mm/dd/yyyy" where the "m", "d" and "y" are numeric.  I have a server side test for a valid date (in Coldfusion) but it accepts any valid date format.  I'd like to force the input to be mm/dd/yyyy and edit it on the server.

Thanks in advance,
hefterr
LVL 1
hefterrAsked:
Who is Participating?
 
Patrick MatthewsConnect With a Mentor Commented:
This does not test for a proper month-end date (e.g., it will accept 02/31/2010):

^[01][1-9]/[0-3]\d/\d{4}$
0
 
hefterrAuthor Commented:
Hey matthewspatrick,
Thanks much!  Works great!  
0
 
ozoCommented:
but it doesn't accept 10/10/2010
0
 
hefterrAuthor Commented:
Hi ozo and matthewspatrick,
hmmmmm, so should it just be : ^[01][0-9]/[0-3]\d/\d{4}$        ??

hefterr
0
 
ozoCommented:
I think that would be better
[0-9] can also be written \d
0
All Courses

From novice to tech pro — start learning today.