JSFiddle - React, Tailwind, and code Playground

JavaScript

var text_source = "<a href='c:/bilmem_ne_dosyasi.xls' target='_blank' style='text-decoration: none'>Dosya Downdload</a><p id='dosyaa'>dosyam benim</p>";
text_search = "dosya";
var patt = new RegExp("(<.*?>)(" + text_search + ")(.*?)(</.*?)","gi");
var text_source = text_source.replace(patt, function(match, $1, $2, $3, $4) {
  	console.log(match);
    return $1 + "<span style='background-color: yellow'>" + $2.toLowerCase() + "</span>" + $3 + $4;
});
document.write(text_source);