Regular Expressions 101

Community Patterns

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

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 - a year ago