Simple Date Validation "I'm very fortunate that my new job is at a cool company working with cool coworkers on cool projects," writes Dave via the Submit to WTF Visual Studio Plug-in.
"Of course, it wasn't always like this. Many years back, WTF Joe (as we now call him) was a key contributor to our codebase and always worked hard to find the hardest way to do the simplest things. Like date validation.
args.IsValid = new Regex(@"^((0?[1-9]|[12][1-9]|3[01])\.(0?[13578]|1[02])\.20[0-9]{2}|(0?[1-9]|[12][1-9]|30)\.(0?[13456789]|1[012])\.20[0-9]{2}|(0?[1-9]|1[1-9]|2[0-8])\.(0?[123456789]|1[012])\.20[0-9]{2}|(0?[1-9]|[12][1-9])\.(0?[123456789]|1[012])\.20(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))$").IsMatch(args.Value, 0);
"I guess his feeling for this was that the database will do another date validation anyway, so it's not that big of a deal."