My text is
<DIV STYLE="text-align:Left;font-family:Segoe UI;font-style:normal;font-weight:normal;font-size:12;color:#000000;"><P STYLE="font-family:Arial;margin:0 0 0 0;"><SPAN STYLE="font-family:Segoe UI;"><SPAN>{firstname} will continue to learn high frequency words, try to remember words and us them in their writing. {firstname} always uses correct spacing in their writing and attempts to use punctuation.</SPAN></SPAN></P></DIV>
So now i want to replace the {firstname} at index 202 with {firstname_C}
My code here doesnot work
var endIndex = 202;
var pattern = new RegExp("({firstname}{" + endIndex + "})", "g");
commentString = commentString.replace("({firstname})/g", "{firstname_C}");
Referred to this code from here