Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
Make square brackets also red in react js

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

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda