Hello,
I'm trying to get these lines of code to change the filename when saving;
from: zAlcatraz
to: HAlcatraz
if(myDocName.indexOf("z")!=-1){
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.
Any thoughts?
Thanks in advance,
GR
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.)
North America
Europe, Middle East and Africa
Asia Pacific