Regex to validate date format dd/mm/yyyy

后端 未结 21 2508
挽巷
挽巷 2020-11-21 06:32

I need to validate a date string for the format dd/mm/yyyy with a regular expresssion.

This regex validates dd/mm/yyyy, but not the invalid

21条回答
  •  说谎
    说谎 (楼主)
    2020-11-21 07:25

    try this.

    ^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d$
    

    you can test regular expression at http://www.regular-expressions.info/javascriptexample.html easily.

提交回复
热议问题