Insert a Backreference into the Regular Expression

If you’ve added one or more numbered or named capturing groups to your regular expression then you can insert backreferences to those groups via Insert Token|Backreference. In the window that appears, click inside the capturing group to which you want to insert a backreference. RegexBuddy automatically inserts a named backreference when you select a named group and a numbered backreference when you select a numbered group. The backreference will match the same text as most recently matched by the capturing group.

For example, the regular expression \b(\w+)\s+\1\b matches a word that it captures into numbered group #1. It then attempts to match one or more spaces followed by backreference #1. The backreference attempts to match the exact same word as the capturing group just matches. Essentially, this regex matches doubled words.

Insert a backreference