Regular Expressions 101

Community Patterns

Match strings starting and ending with the same letter

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(x|y).*\1$
/
gm

Description

This will match all strings starting and ending with the same letters that are specified in the capturing group (in the parentheses).

Submitted by @elliottprogrammer - 2 years ago