Try this regular expression:
\b(\w+)\s+\1\b
Here \b
is a word boundary and \1
references the captured match of the first group.
Regex101 example here
More Related Contents:
- Regex group capture in R with multiple capture-groups
- Negating a backreference in Regular Expressions
- Can’t use ‘\1’ backreference to capture-group in a function call in re.sub() repr expression
- How to match a regex with backreference in Go?
- Regex: match everything but a specific pattern
- Regex lookahead, lookbehind and atomic groups
- Have trouble understanding capturing groups and back references
- RegEx to parse or validate Base64 data
- My regular expression matches too much. How can I tell it to match the smallest possible pattern? [duplicate]
- RE error: illegal byte sequence on Mac OS X
- How do I include negative decimal numbers in this regular expression?
- Is there something like a counter variable in regular expression replace?
- Regular Expression for extracting text from an RTF string
- Why are regular expressions so controversial? [closed]
- What’s the Time Complexity of Average Regex algorithms?
- Regex to find 3 out of 4 conditions
- Escaped Periods In R Regular Expressions
- Regex to get the words after matching string [duplicate]
- Add slash to the end of every url (need rewrite rule for nginx)
- Does lookbehind work in sed?
- Lua pattern matching vs. regular expressions
- R split on delimiter (split) keep the delimiter (split)
- hive regexp_extract weirdness
- Google Sheets Formula for Extracting Domain From Website?
- Does \w match all alphanumeric characters defined in the Unicode standard?
- Matching an optional substring in a regex
- Replace string only once with php preg_replace
- Regex for field that allows numbers and spaces
- Remove all characters before a period in a string
- Get Twitter @Username with Regex in R