Seq1: TACATCTCAAAACACTTTCATCTCACGACTACTACTACTACTTCAAAACACCATCAT
Seq2: ACTTCAACATAACTACTATATACTACTCATACTACTACTCTTAAAACTACTATACTA
The above is the line1 and line2 from your sequence sample. The first shows in red and blue 2 matches from the regex.
In the second identical set, you can see (in red), a match which is 1 character longer than the longest match (in red, above).
My question is why the regex made 2 captures here instead of the optimal match in the second (10 chars instead of 9).
The code which accidentally found this was:
my $xor = $file1contents ^ $file2contents; my $max = 0; my $max_str; my $pos; while ($xor =~ /(\0+)/g) { my $len = length $1; if ($len > $max) { $max = $len; $max_str = substr $file1contents, $-[0], $len; $pos = $-[0]; } #print "matched $-[0] ", substr $file1contents, $-[0], $+[0] - $-[ +0]; } print "at pos $pos max string is $max_str";
In reply to Re^2: FInding the longest match from an initial match between two files
by Cristoforo
in thread FInding the longest match from an initial match between two files
by Allie_grater
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |