I didn't test it, but see if it works:
([AGCT])(?!\1)([AGCT])(?!\1|\2)([AGCT])(?!\1|\2|\3)[AGCT],([AGCT])(?!\
+4)([AGCT])(?!\4|\5)([AGCT])(?!\4|\5|\6)[AGCT]
No, it would only do for 4 char strings only on each side.
What about:
my $str = 'some_str';
my @matches = ($str =~ /^([AGCT]{1,4}),([AGCT]{1,4})$/);
if(2 == scalar @matches){
for my $match (@matches){
my %letters = ();
map { $letters{$_} } ($match =~ /(.)/g);
exit 0 if(scalar keys %letters != length $match);
}
}else{
exit 0;
}
print $str;
:) also didn't test, maybe doesn't work.