Home > Enterprise >  Regex to find three or more repeated number except 999 in Java
Regex to find three or more repeated number except 999 in Java

Time:06-25

Need help to stop user from entering phone number with three or more repeated digits except 999.

Phone number could be 10 digit to 25 digit.

Bad Input:

  • 8777267331
  • 000
  • 66667878763

Exception:

  • 767886655999

I tried --> \b(\d)\3 \b but looks that is not right.

CodePudding user response:

Have a try with

^(?:([0-8])(?!\1\1)|9){10,25}$

enter image description here

  • Related