0

I am using the following regex for my date to validate in dd.mm.yyyy format. But any date containing 19 is not accepting, such as 19.10.2015, 19.09.2015

 var rgexp = /(^(((0[1-9]|[12][0-8])[.](0[1-9]|1[012]))|((29|30|31)[.](0[13578]|1[02]))|((29|30)[.](0[4,6,9]|11)))[.](19|[2-9][0-9])\d\d$)|(^29[.]02[.](19|[2-9][0-9])(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)$)/;

I did not find the problem. Can any body help me.

Hafsul Maru
  • 383
  • 2
  • 12
  • 3
    don't use regex for validating date, have you thought about leap year? – Lucius Oct 16 '15 at 03:59
  • 2
    Consider http://stackoverflow.com/questions/6177975/how-to-validate-date-with-format-mm-dd-yyyy-in-javascript and http://stackoverflow.com/questions/276479/javascript-how-to-validate-dates-in-format-mm-dd-yyyy – S McCrohan Oct 16 '15 at 04:14
  • 1
    Maybe that's because you used `[12][0-8]` in the `dd` part??? – Bergi Oct 16 '15 at 04:18
  • @LiYinKong—it allows for most leap years, not those evenly divisible by 400 though. – RobG Oct 16 '15 at 04:25
  • @ bergi : Maybe that's because you used [12][0-8] in the dd part. Changed it to [12][0-9], not worked. – Hafsul Maru Oct 16 '15 at 04:56

0 Answers0