Link to home
Start Free TrialLog in
Avatar of Charles Baldo
Charles BaldoFlag for United States of America

asked on

Need regex for proper date

I have this expression in a  <asp:RegularExpressionValidator control
(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d

It has a problem with the date. It will allow any day in any month up to the 31.  Is there a regex for a "Valid Date" format  I need it in mm/dd/yyyy format.

Leap year would be super great to catch

Thanks
chuck
SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Charles Baldo

ASKER

I used ideas from both the regex validated a date nice. With a proper format date I could format without fear of it being a bad date.  Thanks Both
Thanks for the assist, and the points.

Good luck & have a great day.