0

The below-mentioned code is not working with internet explorer and working with Chrome

 var serchkeyword = "ko";
 var str = "koneru";
 var newstr = str.replace(new RegExp(serchkeyword , "gi"), (match) => `<span style=color:yellow>${match}</span>`);

While it reaches to 3rd line it not responding in IE and, working in Chrome, Can you please help me to get rid of this.

I think because of (math) it is not working.

When I use

var newstr = str.replace(new RegExp(serchkeyword , "gi"), '<span style=color:yellow>'+serchkeyword+'</span>');

It's working.

harsha
  • 33
  • 8

0 Answers0