Perl Monk, Perl Meditation | |
PerlMonks |
Re^2: Identifying Overlapping Area in a Set of Stringsby reasonablekeith (Deacon) |
on Jul 29, 2005 at 10:31 UTC ( [id://479338]=note: print w/replies, xml ) | Need Help?? |
with inspiration from rnahi i've updated my script to do all that you want. It ought to be
a bit quicker that rnahi's just because of the use if index over regular expressions.
Anyway a BIG caveat to all this is that these result are ambiguous if there could be multiple matches for a given substring. For example searching for "GG" twice in "GGGG" could give you. ORG: "GGGG"; SUB "GG" "GG"; # no overlapping or "--" "--"; # full overlappingso depending on whether you start searching for the second GG _after_ the end of the first GG, (ie from the third character onwards) or from the _beginning_ of first match (first character) you get entirely different results, both of which are correct. It's hard to say which is best, you need to look more closely at what you're trying to acheve. regardless my updated code is as follows... updated mahi->rnahi after tlm's comments
--- my name's not Keith, and I'm not reasonable.
In Section
Seekers of Perl Wisdom
|
|