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
- Repeat a pattern
- Match as little as possible
- Match one of several options
- Capture parts of a match
- Group without capturing
- Name a capture group
All quantifiers, groups and alternation commands · Regular expressions pcre2 cheatsheet