In the given below code, it will search for the word with square brackets and replace the color of only that particular. I want to change the color of square brackets along with word.
if (event.match(/([^[]+(?=]))/g)) {
// event.match(/([^[]+(?=]))/g).style.backgroundColor = "#AA0000";
// if (event.includes("[first name]") || event.includes("[insert ticket concern]")||event.includes("[insert information]")) {
var newTxt = event.split('[');
let sampleText = event;
for (var i = 1; i < newTxt.length; i++) {
let value = newTxt[i].split(']')[0];
console.log(value, "matchhh");
sampleText = this.replacecanned(sampleText, value, `<span style="color: red;">${value}</span>`);
}
Thanks