hefterr
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
but it doesn't accept 10/10/2010
ASKER
Hi ozo and matthewspatrick,
hmmmmm, so should it just be : ^[01][0-9]/[0-3]\d/\d{4}$ ??
hefterr
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
[0-9] can also be written \d
ASKER
Thanks much! Works great!