I want to check if the user’s input in the server side.
If the user enters a number 111111 or 22222 which has the same numbers,
and also if the input is in sequence like 12345 or 456789.
I want to check if the user’s input in the server side. If the
Share
To match consecutive same digits:
Note that you have to escape the backslash when you put it in a java string literal, for example,
For the second one you have to explicitly make a list of consecutive digits using the
|operator. The regex would be really long and nasty with as many as 10-nested parantheses. One has to generate this regex using a program. In other words, this is a wrong problem to solve using regex. It would be much simpler to write a loop and test this.