Script to Find layer names that include CMYK (non-case specific i.e. CMyK)
Hi all,
I have a script that will find layers names that contains "CMYK", but I want it to be able to also find them when they contain any variation of case structure i.e. "cMYk", no matter upper or lower case. It's easy when using InDesign's Find/Change, you just add (?i) to the start of .*CMYK.* and it finds them, but it won't within my script.
Can someone please tell me why and how to change it so it works.
for ( count = 0; count<app.activeDocument.layers.length; count++)
{ layer = app.activeDocument.layers.item(count).name; // Create variable from Layer name
this["Layer"+(count)] = layer // Creates individual variable from Layer name and number (i.e. Layer0 = CMYK)
if (layer.replace( RegExp("(?i).*CMYK.*") , "CMYK" ) == "CMYK") {alert(count+": "+layer)} // If the layer includes "CMyK" (not case specific) then it doesn't work
}
Thanks for any help, Bren
