Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?!(.{2,})\g1+$).{2,}$
/
gm

Description

Matches all lines whose length is a prime number and only contain the character "1".

Submitted by pablo - 8 months ago (Last modified 8 months ago)