En el siguiente código, buscará la palabra entre corchetes y reemplazará el color de solo ese particular. Quiero cambiar el color de los corchetes junto con la palabra.
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>`); }Gracias