while($seqR =~m/([ATGC])\g1{2,6})+/g) { my $position = pos; print "$& found at $position\n" };