What is the MM/DD/YYYY regular expression and how do I use it in php?

后端 未结 9 968
清歌不尽
清歌不尽 2020-12-03 05:11

I found the regular expression for MM/DD/YYYY at http://www.regular-expressions.info/regexbuddy/datemmddyyyy.html but I don\'t think I am using it correctly.

Here\'s

9条回答
  •  抹茶落季
    2020-12-03 05:25

    This checks valid dates from MM/DD/1960 to MM/DD/2014

    Also accepts dates like M/D/YYYY and 0M/0D/YYYY

    ^(?:[1-9]|0[1-9]|1[0-2])/(?:[0-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])/(?:20[6-9][0-9]|20[0-1][0-4])$
    

提交回复
热议问题