Correct Regular expressions to match a date

后端 未结 11 624
不知归路
不知归路 2021-01-27 09:50

What is the correct regular expression to use to validate a date like. 2009-10-22 or 2009-01-01 etc. Platform PHP

11条回答
  •  醉梦人生
    2021-01-27 10:31

    [0-9]{4}-[0-9]{2}-[0-9]{2}
    

    or

    \d\d\d\d-\d\d-\d\d
    

    or

    ...

    simply read first regex tutorial

提交回复
热议问题