We need help for regular expression that work with asp.net asp:RegularExpressionValidator to validate date in MMddyy format. Problem we are facing is leap year. Issue is tha
Since you need logic to validate leap years, consider using a CustomValidator. I put this together relatively quickly, but hopefully you'll get the idea.
protected void dateFormatValidator_ServerValidate(object source, ServerValidateEventArgs args)
{
if (args.Value.Length == 6)
{
var month = args.Value.Substring(0, 2);
var day = args.Value.Substring(2, 2);
var year = args.Value.Substring(4, 2);
DateTime dummyValue;
args.IsValid = DateTime.TryParse(month + "/" + day + "/" + year, out dummyValue);
}
else
{
args.IsValid = false;
}
}