Regular expression for Year Format
Posted on 2013-05-16
I am using VS2010 and C#.Net
I am trying to validate the years entered in a TextBox.
It can be two formats.Ex:2013-2012(fourdigitshyphenfourdigits) or 2009(fourdigits)
I am trying this expression and it is failing for 2011 @"20\d *- *20\d";
The first digit should be Two and second digit is zero and third digit and fourth digit can be any thing 0-9.
I tested for 2013-2012 and it worked fine. But it is not working for 2011.