Hey Mike! I don't know a single expression to match both cases but you should be able to adjust this expression to handle both of them:
"^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](((19|20)\\d\\d)|([2-9]\\d\\d\\d))$"
This expression will match a date between 01/01/1900 - 12/31/9999 (SQL Server Min and Max Dates) so you could just alter the last section of the expression to handle only 2 digit years.
Lastly, for some reason, I can not get this expression to work in the Validation Controls and have to call the expression in code to validate user input.
This is how I do it:
Code:
public static bool isDate(string Value)
{
System.Text.RegularExpressions.Regex ex = new Regex("^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](((19|20)\\d\\d)|([2-9]\\d\\d\\d))$");
return ex.Match(Value).Success;
}
hth
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
================================================== =========