the same sequence is also in the [file 2], but, with "." and "-" in it, like:SGFEFHGYARSGVIMNDSGASTKSGAYITPAGETGGAIGRLGNQADTYVEMNLEHKQTLDN [file 1]
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. I guess the answer is to turn the substrings you are looking for into regular expressions that accommodate the presence of '-' and '.' between the letters. For example,...---SGFEF....HG-.--YARSGVI---MNDSGAS..--TKSGAY--....--ITPAG--ETGGAI. +.GRLGN--Q..AD---TY--V..EMNL--EHKQTLDN [file 2]
The use of the grouped regexp between /.../ allows you to remember the substring that matched the regexp. But i'm not sure with that,can you please give some idea or give me your script if it's possible.#!/usr/local/bin/perl $str = "a-\.*?b-\.*?c"; $str2 = "zzzza---..bcddd +dd"; $str2 =~ /($str)/; print $1,"\n";
Dec 18, 2025 at 20:06 UTC McDarren Added code tags
In reply to find the substring by roc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |