Regular expressions pcre2 · Quantifiers, groups and alternation

Match repeated text

Match a repeated word such as the the, using a backreference to the first group.

\b(\w+)\s+\1\b

Official Regular expressions pcre2 documentation

More quantifiers, groups and alternation commands

All quantifiers, groups and alternation commands · Regular expressions pcre2 cheatsheet

Was this page helpful?