-
Highlight Text by ** Symbols
Hi all,
i have to modify a setup, which allows the user to highlight one or multiple words by adding “**” before and after. The original setup works by adding “=” ( For example: This is a =Highlight=). On a separate Text Layer, everything outside those two “=” characters is then faded out by an expression selector and a specific font is chosen to generate a colored box behind the marked text (in this example only behing the word “Highlight”). This setup works pretty good so far, but i can
t find a way to mark the words to be highlighted with "**" (two characters) instead of "=" (only one character). Anyone any idea how to modify the expression to make it work? i tried changing the if statement to for if (txt[i] == "*" && txt[i+1] == "*" ), but this doesnt seem to work as expected.const txt = thisComp.layer(“Master_Text”).text.sourceText.replace(/\n|\r|\u0003/g,””);
var txt_highlight = false;
var count = textIndex;
for (i = 0; i < count; i++) {
if (txt[i] == “=”) {
txt_highlight =! txt_highlight;
count++; i++;
}
}
if (txt_highlight == 1){
0;
}
else{
100;
}