Multiple regex condition

Viewed 37

I have a regex wherein it doesn't accept 7 consecutive same numbers:

/^(?!.*([0-9])\1{6}).*/

If I want to add another validation to the above condition, where/how can I add this? i.e, I want to only accept numeric values and limit the maxLength to 15

1 Answers

Change .* at the end to the pattern for the entire string.

/^(?!.*(\d)\1{6})\d{1,15}$/

DEMO

Related