Regular Expression Match to test for a valid year

后端 未结 14 1739
清歌不尽
清歌不尽 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 03:14

    You could convert your integer into a string. As the minus sign will not match the digits, you will have no negative years.

提交回复
热议问题