Regular Expression To Check For Repeating Numbers

A regular expression to match repeating digits in a given number. Can be used to check if a number or string has duplicated digits.

/([0-9])\1+/g

Matches:

  • 12333
  • 111111
  • abc111def

Non-matches:

  • 123123
  • aaa
  • abc123abc

See Also:

Regex Is Copied!