RegEx - Time Validation ((h)h:mm)

后端 未结 6 1653
春和景丽
春和景丽 2021-02-13 12:46
/^\\d{1,2}[:][0-5][0-9]$/

is what I have. this limits minutes to 00-59. It does not, however, limit hours to between 0 and 12. For similarity and unifo

6条回答
  •  闹比i
    闹比i (楼主)
    2021-02-13 13:09

    /^(10|11|12|[1-9]):[0-5][0-9]$/
    

    I don't think that you want 0:50 as a valid time either.

提交回复
热议问题