u can use $regsub
for example
var %x
.echo -q $regsub(7Hellow4whassup7How are you
,7,\[COLOR=orange\],%x)
the result will be stored in %x