"be consistent" | |
PerlMonks |
Re: Regex - remove characters (pattern not terminated)by twaddlac (Novice) |
on Jul 01, 2010 at 19:07 UTC ( [id://847590]=note: print w/replies, xml ) | Need Help?? |
Thank you for all of your help! I finally got it working! However, I have another question. I'm not very familiar with lookarounds but I think that they would increase the throughput of my program exponentially! I would like to use a lookahead (and/or lookbehind, I don't really know the difference..) assertion after matching a pattern (from a list of patterns) at either the beginning or end of the string. The lookaround would search for an adjacent pattern that is also from the list (NOTE: order does not matter!). If there is no known adjacent pattern, then remove the 6 characters preceding or following the pattern (as we have done already); if there is a pattern, proceed with some other instruction (of which is not relevant). The following is pseudocode to help explain:
The output for $string_1 would be: string_1 = 1234567890 as it had an adjacent known pattern, the program performed some other function. The output for $string_2 would be: string_2 = 0 as it did not have an adjacent known pattern, the pattern that was matched and the following 6 characters were removed. Let me know if you need to know anything else!! Thank you very much!!
In Section
Seekers of Perl Wisdom
|
|