moluapple​ we're in the final stretch. I have made terrific progress with so much, but these last four issues remain. #1 Using the regex quick start you provided a link to I was able to create the following (i.e. Do not use(?= \•with any other fuel source additives). This is great as I needed to apply a bold style to "Do not use", but that statement appears elsewhere in the copy. Here's the thing – the regex quick start say that this should work for a backwards look around (i.e.(?<=Do not use \•with any other fuel source )additives) should bold the "additives", but it doesn't find the reference? Again, the word additives elsewhere in the copy. What am I doing wrong? #2 These pesky "\t" are still not working… // Thick rules var search_string = /^\t\r/g; var active_doc = app.activeDocument; var stories = active_doc.stories; var chart_layer = active_doc.layers.getByName('Chart'); for (var i = 0; i < stories.length; i++) { var this_story = stories; if (this_story.textFrames[0].parent == chart_layer) { var match = search_string.exec(''); while (match = search_string.exec(this_story.textRange.contents)) { var match_chars = this_story.textRange.characters[match.index]; // match_chars = "T" match_chars.length = match[0].length; // now match_chars = "Title" active_doc.paragraphStyles.getByName("Thick rule_FLX").applyTo(match_chars, true); } } } What am I missing? #3 The square bullets which we figured out previously were never restricted to the Chart layer. This is what I have. See my code comments (//) // Square bullets – this includes the restriction to the chart layer but doesn't apply the character style to the 3rd character of the match var search_string = / n)/g; var active_doc = app.activeDocument; var stories = active_doc.stories; var chart_layer = active_doc.layers.getByName('Chart'); for (var i = 0; i < stories.length; i++) { var this_story = stories; if (this_story.textFrames[0].parent == chart_layer) { var match = search_string.exec(''); while (match = search_string.exec(this_story.textRange.contents)) { var match_chars = this_story.textRange.characters[match.index]; // match_chars = "T" match_chars.length = match[0].length; // now match_chars = "Title" active_doc.characterStyles.getByName("Square Bullet").applyTo(match_chars, true); } } } // Square bullets - this does everything except restrict the search to the chart layer var search_string = / n/gi; // g for global search, remove i to make a case sensitive search var active_doc = app.activeDocument; var text_frames = active_doc.textFrames; if (text_frames.length > 0) { for (var i = 0; i < text_frames.length; i++) { var this_text_frame = text_frames; var match = search_string.exec(''); while (match = search_string.exec(this_text_frame.contents)) { this_text_frame.characters[match.index + 1].contents = replace_string; // replace "▪" with " n" active_doc.characterStyles.getByName("Square bullet") .applyTo(this_text_frame.characters[match.index + 2], true); // only apply to "n", leave space } } } I obviously am having trouble with the "while" statement and how it works? #4 Related to the "\t" issue I have a commonly formatted string which has different information but appears over many lines within the copy deck. This common string references a product, then a weight reference, then the space tab space (filled with character) and then a price. Like this… Fuel additive 500 mg..................................$12.00 Oil supplement 300 mg................................$3.00 etc. I tried this regex line. "var search_string = / ˆ.+ mg \t .+$/g;" I thought it would select everything before the "mg" and after the "\t" and apply the paragraph style to it, on the line which it finds that information on, but it is applying the style to the entire text frame? Is there a way to limit it? I am so happy for the help you have provided so far. Down to the wire now. Cheers, Marcrest
... View more