How to disallow consecutive five digits and more using regex?

后端 未结 2 1866
栀梦
栀梦 2021-01-29 06:58

I would like to disallow if the string contains consecutive five digits and more like: 12345, 11111, 123456.

I have got success in disallowing any number in string using

2条回答
  •  野的像风
    2021-01-29 07:19

    This is a good website for testing your regex:

    https://regex101.com/

    You could try this:

    /^[0-9]{5,}$/
    

    5 numbers or more will pass the regex.

提交回复
热议问题