I'm trying to get these lines of code to change the filename when saving;
var myRegularExpression = /\\<z/gi
myDocName = myDocName.replace(myRegularExpression, "H");
I'm trying to target just the first z at the front of every filename but can't get the grep correct.
Thanks in advance,
Use the below codes...
myDocument = app.activeDocument;
path = myDocument.fullName;
var x = path.toString().replace("z", "H");
Hope this will help you...
Thanks and Regards,
Vel's code will replace all instances of lowercase 'z' with uppercase 'H' -- even the ones in the file path.
Better try this:
myDocName = app.activeDocument.fullName.path+'/'+app.activeDocument.fullName.name .replace(/^z/i, "H");
(The GREP code you were probably looking for is '^' -- start of 'line', in this case equal to the start of the string.)
Europe, Middle East and Africa