0

I cant realize and find a regular expression to detect sequences of repeated numbers (more than 2 times) like:

1111 or
a1111 or
test4555

Someone can help me please?

silviomoreto
  • 5,629
  • 3
  • 30
  • 41

1 Answers1

11

You can write:

/(\d)\1\1/

where \d means "a digit", (...) means "capture (remember) what ... matched", and \1 means "what the first (...) captured".

ruakh
  • 175,680
  • 26
  • 273
  • 307