- or download this
DB<6> $x = 'helloworldhellohellohihellohiworldhi'
...
hi
h
l
- or download this
DB<8> print "$1\n" while $x =~ /(\w{2,})(?=.*\1.*\1)/g
hello
hello
hi
- or download this
sub repeat_finder_re {
my $n = shift;
'(\w{2,})(?=' . ('.*\\1'x($n-1)) . ')'
}