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 - 10 months ago (Last modified 10 months ago)