Link to home
Create AccountLog in
Avatar of hefterr
hefterrFlag for United States of America

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of hefterr

ASKER

Hey matthewspatrick,
Thanks much!  Works great!  
but it doesn't accept 10/10/2010
Avatar of hefterr

ASKER

Hi ozo and matthewspatrick,
hmmmmm, so should it just be : ^[01][0-9]/[0-3]\d/\d{4}$        ??

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