Hi, this is great, but I can only get it to work on the first character of the regex I input i.e. I need to change 'EN' to another font so have used 'var reg = /EN/g;' but it only seems to change the 'E' and not the 'N' to my desired font.
Your own script snippet only changes the first occurrence of your search string in a text frame.
The problem is: For the solution in the other thread, we didn't need all the properties of reg.exec ()
But we absolutely need the properties for your request.
Try the following:
// regards pixxxelschubser
var aDoc = app.activeDocument;
var aTF = aDoc.textFrames;
var reg = /EN/g;
var res = null;
var aCon = null;
while (res = reg.exec(aTF.contents))...