Regular expression for validating date in asp net

29th in 2013, but this regex asserts that such is valid:

regular expression for validating date in asp net-12regular expression for validating date in asp net-15

x) # modifier x: free spacing mode (for comments) # verify date dd/mm/yyyy; possible separators: -.,/ # valid year range: 0000-9999 ^ # start anchor # precheck xx-xx-xxxx,...

: # day-check: non caturing group # days 01-28 0[1-9]|1\d|[2][0-8]| # february 29d check for leap year: all 4y / 00 years: only each 400 # 0400,0800,1200,1600,2000,...

It's hard to get right, the expression is difficult for non-regex wizards to understand (which means it's difficult to prove that the thing is correct), and it is slow compared to other options.

:1[6-9]|[2-9]\d)\d))$)$ Parsing dates with regular expressions is possible, but frustrating.

How can I use the range validator to validate a valid date?

If I enter 1 January 1000 as the min or max value I get an error saying value cannot be converted to type date, but if I use another format it picks up my entered text as invalid.

:0[1-9]|1[012]) # year 0000-9999 .\d $ # end anchor /^(?

:[02468][1-35-79]|[13579][0-13-57-9])00) # 00,04,08,12,... .02)| # d31 positive lookahead: month up to 31 days 31(? :0[13578]|10|12)) ) # eof day-check # month 01-12 .(?

([0-9](([2468][048]|[02468][48])|[13579][26])|([13579][26]|[02468][048]|0[0-9]|1[0-6])00))$ ^(((0[1-9]|[12][0-9]|30)[-/]?

([0-9](([2468][048]|[02468][48])|[13579][26])|([13579][26]|[02468][048]|0[0-9]|1[0-6])00))$ ^([0-9][-/]?

q=Regular expression for validating Date format dd/MM/yyyy&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a Hi Rameez, Checkout Patterns.aspx?

Comments are closed.