Within an Extendscript Regex search in an InDesign document, it seems that I can't use the "+" operator to concatenate the "\u" and and 4-digit Unicode value. Example:
var text = abcabcabc;
var re = new RegExp("\u0061", "g");
text = text.replace(re, "X");
will bring XbcXbcXbc
as expected, but
var text = abcabcabc;
var u = "0061";
var re = new RegExp("\u" + u, "g");
text = text.replace(re, "X");
will bring \u0061bc\u0061bc\u0061bc
.
So what's wrong here? Is it the +
operator that doesn't work at this point? Is there any other possibility to concatenate the two components so that they are recognized as a complete Unicode value? Any advise is highly appreciated.