Trying to apply GREP styles via data merge but getting inconsistent results
I'm putting together a set of investor reports, one for each product that our investors have invested in. Each one has a different brand color associated with it. So far data merge has been great for this, but I've had to go in after the merga an manual change accent text and other elements to the correct brand color.
I found a video for how to automate this process by
- creating a field in my csv for color (lets just call it "Color"), and filling ti with something like {red}, {blue}, {green} etc.
- putting the <<Color>> data merge tag on either side of each instance of accent text,
- creating a character style called "invisible" that gives it a color of none and shrinks it to the smallest font size possible
- Applying a few GREP styles to the paragraph: Apply invisible character style to any instance of the text {red}, {blue}, or {green}:
\{red\}|\{blue\}|\{green\} etc.
Apply color red to text with {red} on either side of it:
(?<=\{red\})(.*?)(?=\{red\})
Do the same with green, blue, etc
I've done the GREP styles with a paragraph style I'm calling "color changinig" and applied it (along with the data merge tags) to about a dozen instances of text among different text boxes in the report. When I hit preview it works for the first instance and none of the others. When it doesn't work, none of the GREP rules are applied- the text that should get the invisible character style isn't, and the colors aren't changing.
It would be simpler if it didn't work at all, but it's working perfectly in exactly one place. I don't see what the difference between the instances of text are. Any ideas how to troubleshoot?
