Regular expression to highlight duplicate words in a string
Posted
by murugaperumal
on Stack Overflow
See other posts from Stack Overflow
or by murugaperumal
Published on 2010-03-24T03:51:55Z
Indexed on
2010/03/24
4:23 UTC
Read the original article
Hit count: 460
I want a Perl regular expression that will match duplicated words in a string.
Given the following input:
$str = "Thus joyful Troy Troy maintained the the watch of night..."
I would like the following output:
Thus joyful [Troy Troy] maintained [the the] watch of night...
© Stack Overflow or respective owner