in reply to Regular expression for a comma separated string
No, it would only do for 4 char strings only on each side.([AGCT])(?!\1)([AGCT])(?!\1|\2)([AGCT])(?!\1|\2|\3)[AGCT],([AGCT])(?!\ +4)([AGCT])(?!\4|\5)([AGCT])(?!\4|\5|\6)[AGCT]
:) also didn't test, maybe doesn't work.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;
|
|---|