fletcher_the_dog has asked for the wisdom of the Perl Monks concerning the following question:
I would want it to change the above phrase to:s/(\w+)\s+tacos/$1 yummy tacos/g;
but my script requires quite a few complicated regexes substitutions and having optional "(<\w\w>)?"s everywhere will make the regexes very ugly and make it hard to keep track of which capturing parenthesis are catching what.s/(\w+)\s+(<\w\w>)?tacos/$1 yummy $2tacos/g;
Another possibilty I have considered and tried was erasing all the tags and then after I was done with all the substitutions doing a diff and trying to reconstruct where the tags should go. This actually works but was way too slow.$string = [ ['I','<5b>'], [' '], ['l','<5c>'], ['i'], ['k'], ['e'], [' '], ['t','<5d>'], ['a'], ['c'], ['o'], ['s'] ]
|
|---|