I have this regex which currently works for CSS/JS/link i.e. does not replace a keyword when it is inside CSS/JS/link.
var re = new RegExp("\\b" + keyword + "\\b(?!(?:[\\s\\S](?!<(?:a|script|style)\\s))*</(?:a|script|style)>)","i");
Next step is improve it so it doesn't replace the keyword in HTML comment, inside of a tag e.g. as an attribute or in value of the attribute, iframe
e.g. <div title="test KEYWORD" KEYWORD="true"><div>
any ideas ?