In JavaScript I can uses a regex to replace tex:
var textSearch = "10";
var textReplace = "2";
var c = alayer.textItem.contents
c = c.replace(new RegExp(textSearch, "g"),textReplace);
alert(c);
text strings of "10" gets replaced with "2". Huzzah!
However, I was unable to do a global replace without a new RegExp constructor I got into a mess.
c = c.replace(textSearch, textReplace); //2 10 10
I tried various iterations of /g and "g" to no avail.
Do you have to uses regxEx in the form of new regExp() when using variables, or am I missing a trick? Reginald X. Pression where are you?? I need your help!