DB<6> $x = 'helloworldhellohellohihellohiworldhi' DB<7> print "$1\n" while $x =~ /(\w+)(?=.*\1.*\1)/g hello o l hello h l l o hi h l