in reply to find all repeating sequences
If I'm understanding you correctly:
#!/usr/bin/perl my @seqs=qw(AAAA ABAB CCC DDDDDDD EEEEFFF); foreach my $seq (@seqs) { if($seq =~m/^(\w)\1{2,6}$/) { print "$seq: REPEATED\n"; } else { print "$seq: NOT REPEATED\n"; } } Outputs: AAAA: REPEATED ABAB: NOT REPEATED CCC: REPEATED DDDDDDD: REPEATED EEEEFFF: NOT REPEATED
But that would only match things like AAAA versus things like AAAAABBB. Not sure exactly what behavior you're looking for.
Edit: The magic here is backreferences and capture groups. See this bit in the perlre docs.
|
|---|