Cheatsheet Pages / Regex Cheatsheet
How to match the same text twice — backreferences with \1
The closing quote must equal the opening one; the repeated word must be the same word.
Patterns use the syntax shared by PCRE / Python / JavaScript; engine differences are flagged in the cheatsheet where they matter. Test any pattern at regex101.com — and pick the matching engine.
(['"]).*?\1
# "hello" or 'hello' — closing quote must match the opening one
(\w+)\s+\1
# repeated word: "the the"
