in reply to regex backreference

All three-letter words in a line that repeat? Test if the following will do:
my @words = $txt =~ m/\b(\w{3})\b(?=.*\b\1\b)(?!.*\b\1\b.*\b\1\b)/g;

The (?!...) is a negative look-ahead assertion. If you leave that out, duplicates appear for words occurring more that twice. And (?=...) is the positive look-ahead assertion.