Matching the same word twice with a regular expression, not caring what the word is
Try this:
/(\w+)\.\1/g
This uses the \1
backreference to match the text of first capturing group (\w+)
.
Tested on http://regexpal.com/ and works.
Should be with global!
/(\w+)\.\1/g;