Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
PCRE (PHP <7.3)

/
\b(?![01]*([01])\1{4})[01]+\b
/
gm

Description

0111100 will be matched whereas 0111110 will not. Change \1{4} to max repeating count. For max 9 repeating -> \1{9}

Submitted by anonymous - 9 years ago