Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^([a-b]).*\1$|^[a-b]{1}$
/
gm

Description

regex that will test string that begins and end with the same string character and also works if there is only one character in string

Submitted by Ananya - 2 years ago