Hello All,
I've run into bit of a problem trying to replace text. I've been using a replace script to add trademarks and register marks to brand names in a product line. For example.:
var s = Field("Product Line 1");
FusionPro.Composition.AddVariable
s = s.replace(/Blue/ig, "<span>" + " BLUE" + "<f name=\"Arial\">" + "<p br=false superoffset=180 superratio=25><superscript>®</superscript>" + "</span>");
return s;
This works great in most cases, but I've recently come across some variations I'm not sure how to handle. For example, sometimes the product line should be "All BLUE® products on sale", but there are other cases where it should read, "All BLUE Boo Bars® on sale".
In the second scenario "BLUE" should not proceeded by a ®. Unfortunately I end up with "All BLUE® Boo Bars®".
I have hundreds of brand names to consider and most of them have this sort of variation. Just wondering if anyone has any ideas on how to conquer this. Any help would be greatly appreciated.