Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!