the same sequence is also in the [file 2], but, with "." and "-" in it, like:
...---SGFEF....HG-.--YARSGVI---MNDSGAS..--TKSGAY--....--ITPAG--ETGGAI..GRLGN--Q..AD---TY--V..EMNL--EHKQTLDN [file 2]
Let's say I want to check how two substrings (namely SGASTK and GNQADT) have become in file 2 compared to what they were in file1.
I see that SGASTK, that was substring 19-24 in file1 is now SGAS..--TK and substring 36-41.
GNQADT which was substring 42-48 in file1 is now GN--Q..AD---T and substring 76-82.
My question is how can i find the old substrings from file 1 in file 2 and how can i store the new begginings and endings of the new substrings in file2...
#!/usr/local/bin/perl
$str = "a[-\.]*?b[-\.]*?c";
$str2 = "zzzza---..bcddddd";
$str2 =~ /($str)/;
print $1,"\n";
The use of the grouped regexp between /.../ allows you to remember the substring that matched the regexp.