Regular Expressions 101

Community Patterns

Regex that only matches itself

0

Regular Expression
PCRE (PHP <7.3)

/
^<()(?R){2}>\z|\1\Q^<()(?R){2}>\z|\1\Q
/

Description

It matches and only matches this regex, including the delimiters. It could be 4 bytes shorter if <> are used as the delimiters instead. From Programming Puzzles & Code Golf.

Submitted by jimmy23013 - 7 years ago