Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear wise Monks,
I have an original string and a modified one;
$Original = "AABBCCDDEEFFGGHH" $Modified = "bCCDdEEFfgGH"
The modified is a substring of original with lower capital letters at some random position. What I would like to do is to find the position of the Modified string within the Original and append the flanking characters that are missing from the modified (in lower letter). The small letters in Modified should stay as they are and sometimes there can be "-" character within the string (like "AABB-AA"). So the output;
$Modified = "aabbCCDdEEFfgGHh"
I thought about using regex than split using this regex then using soft referencing but I think that's overdoing it. BTW what would be the best perl functions to learn to help me with this sort of task in the future? Thanks all for help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex + substring
by JavaFan (Canon) on Mar 27, 2012 at 11:19 UTC | |
|
Re: Regex + substring
by moritz (Cardinal) on Mar 27, 2012 at 11:49 UTC | |
by Anonymous Monk on Mar 27, 2012 at 12:08 UTC | |
|
Re: Regex + substring
by AnomalousMonk (Archbishop) on Mar 27, 2012 at 14:36 UTC | |
by Anonymous Monk on Mar 27, 2012 at 16:10 UTC | |
by AnomalousMonk (Archbishop) on Mar 27, 2012 at 16:24 UTC | |
|
Re: Regex + substring
by jwkrahn (Abbot) on Mar 27, 2012 at 11:41 UTC |