Regular Expression Match to test for a valid year

后端 未结 14 1755
清歌不尽
清歌不尽 2020-11-29 02:27

Given a value I want to validate it to check if it is a valid year. My criteria is simple where the value should be an integer with 4 characters. I know this is

14条回答
  •  借酒劲吻你
    2020-11-29 02:58

    I use this regex in Java ^(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/](19|[2-9][0-9])[0-9]{2}$

    Works from 1900 to 9999

提交回复
热议问题