Is it possible to match \"the dog is really really fat\" in \"The dog is really really fat!\" and add \"
The dog is really really fat!
A simpler way with JQuery would be.
originalHtml = $("#div").html(); newHtml = originalHtml.replace(new RegExp(keyword + "(?![^<>]*>)", "g"), function(e){ return "" + e + ""; }); $("#div").html(newHtml);
This works just fine for me.