what will be the regular expression of date format like '01-Aug-12'.
I have the date format of dd-M-y in asp.net application and want to validate it from asp.net regular expression validator control.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This won’t be too elegant, but if you want to use regex to validate dates, it is here:
The regex with explanation
This regex doesn’t accept invalid dates like
00-Aug-00,32-Aug-00and29-Feb-01while accepting valid dates including leap days (29-Feb-04). Note that we assume00stands for year2000, not1900. So, we accepted29-Feb-00as leap day!In one line:
See it in action:
Case-insensitivity
In Javascript, add an
ias second parameter:In ASP.NET, use RegexOptions.IgnoreCase: