Forum Moderators: open
var rg=new RegExp(expr,"gi");
var endresult = contentString.replace(rg,function(thematch){
return '<span style="color:black;background-color:yellow">'+thematch+'</span>' ; } );
The problem with the code is , it is replacing even substrings but i want to replace only stings(i.e only if it is a full word). can any knows it please help.