Matching Repeated Words:
(\b\w+\b)\s+\1
fox
and dog
.Matching Repeated Characters:
(\w)\1+
oo
.Matching Repeated Numbers:
(\d{3})-(\1)-(\d{4})
123-123-4567
.Matching Repeated Letters:
(ha)+
hahaha
.Matching Repeated Patterns in HTML Tags:
<(\w+)>(.*?)<\/\1>
<div><p>Hello</p></div>
. Captures div
and p
tags.Matching Repeated Whitespace:
(\s)\1+
Matching Repeated Hexadecimal Digits:
([0-9A-Fa-f])\1
1A
, 2B
, and 3C
.Matching Repeated Letters Only at the Start of a Word:
(\b\w)\1\w*
apple
and orange
.Matching Repeated Words with Different Case:
(\b\w+\b).*?\1
The the
.Matching Repeated Consonants:
([bcdfghjklmnpqrstvwxyz])\1+
mming
and n
.