http://www.perlmonks.org?node_id=1169104


in reply to Re^2: regex issue
in thread regex issue

Small correction, you missed a word-boundary assertion in the look-ahead. The regex should be:
/\b(\w\w\w)\b(?=.*\b\1\b)/g
Without the additional \b before \1, three-letter words that are trailing substrings of other words would also match.