Regular Expressions 101

Community Patterns

Match consecutive 8 identical numbers regardless of any character at start or end with string length between 8 and 20

0

Regular Expression
PCRE (PHP <7.3)

/
^(?=.{8,20}$)(\b\D*(\d)\2{7,}\D*\b)$
/
g

Description

Match 8 or more consecutive digits irrespective of it's position in the string with string length between 8 and 20. ex: 11111111 - match ASD11111111 - match ASD22222222oook - match 777kjoi77777 - no match etc.,

Submitted by Cyanotrix - 7 years ago