There is a mask for the number A of BBBBB A. For this mask, wrote a regular expression
/([0-9])\1{0}([0-9])\2{4}([0-9])\3{0}/ But the result is that, for example, the number 2555553 also fits this mask (as well as, for example, 5555552). As I understand it, I incorrectly understand the principle of the group.
Is it possible to describe this mask with one regular expression or will it be necessary to add a crutch (the first and last digits are equal and there are no repetitions more than 5 times)?
/([0-9])\1{0}([0-9])\2{4}\1{1}/- Yaant