Regular Expression - 4 digits in a row, but can't be all zeros

前端 未结 5 1762
北荒
北荒 2021-01-04 02:31

I am looking for a solution that can exclusively be done with a regular expression. I know this would be easy with variables, substrings, etc.

And I am looking fo

5条回答
  •  迷失自我
    2021-01-04 02:45

    Just match for 4 digits (\d{4} should do it) and then verify that your match is not equal to '0000'.

提交回复
热议问题