in reply to Regexps for microsatellites

Does this do what you want?
my $thresh = 3; # as per Ikegami's note, pattern must repeat MORE THAN + this many times while (<DATA>) { while (/((.{1,6})\2{$thresh,})/g) { printf "$2 (length=%d) repeats in $1\n", length $2; printf "Found at $-[0] to %d in $_", pos()-1; } } __DATA__ GATTATTATTATTATTATTGCATATATATAGCAAAAAATTTTTTGC ATATTATATTATATTATATTGC ATAGACATAGACATAGAC

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: Regexps for microsatellites
by ikegami (Patriarch) on Nov 08, 2004 at 16:18 UTC

    The threshold is off by one. Your regexp matches "more than N" rather than "N or more". Subtract one from $threshold before building your regexp.