Neither of those produces the desired output for me. $x is never incremented. Since you require a space at the end of the string-to-be-substituted, there is no substitution after the last abc, and the desired spacing in the output is wrong:
Those problems were present in the OP's posted code. They weren't problems with the post to which you replied. Presumably, the OP's code is different than what he posted, since the output he gave doesn't match the code he posted. Since the OP will have to retrofit the solution anyway, these details aren't important. That's why I took a few small liberties in my own solution.
In reply to Re^3: Progressive matching w/substitutions
by ikegami
in thread Progressive matching w/substitutions
by argv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |