Perl: the Markov chain saw | |
PerlMonks |
Re: Regex to match range of characters broken by dashesby AnomalousMonk (Archbishop) |
on Jul 16, 2016 at 06:30 UTC ( [id://1167872]=note: print w/replies, xml ) | Need Help?? |
Like choroba, I'm wondering: What's supposed to happen to the dash in the 4th position in the second string? Assuming it should be replaced by $tag because it's between the quantified groups of bases, here's a multi-regex solution. (Warning: Needs Perl version 5.10+ for the \K regex operator — but I can get around that fairly easily if needed.) Of course, more test cases are highly encouraged! Update: And yes, this does seem like an XY Problem.
Update 2: Here's the pre-5.10 (no \K) version of the code (tested): Give a man a fish: <%-{-{-{-<
In Section
Seekers of Perl Wisdom
|
|