Did you try it with the example string I mentioned in my post? Here's a command with Raccoon's original code:
//var %x = ab3def7 | !.echo -q $regsub(%x,/^(.)(.)(.*)(.)(.)$/g,\104\2\304\4\5,%x) | echo -s %x
here's the 1st way it should be modified:
//var %x = ab3def7 | !.echo -q $regsub(%x,/^(.)(.)(.*)(.)(.)$/g,$+(\104\2,$str($chr(2),2),\304\4,$str($chr(2),2),\5),%x) | echo -s %x
Also try //echo -s $color2chars(ab3def7)