Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Pattern matching forwards/backwards???by Anonymous Monk |
on Jun 15, 2009 at 10:48 UTC ( [id://771612]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello all! Say you have a string: (you can have only - and . between letters). If I want to "expand" XFGHWW to get the 3 most close letters to it (HRE from EWGREGERABCSHRE), how could I write a pattern match? My goal is to read the search backwards, that is I won't know beforehand the format of the total string... That means that the algorithm would be like: 1. Find substring XFGHWW 2. From its left, get 3 letters, that are now . or - 3. Print the new substring.
Back to
Seekers of Perl Wisdom
|
|