wrap word with link, if not part of a link
http://stackoverflow.com/questions/12821244/using-jquery-or-js-how-do-you-turn-a-string-into-a-link
by webrocker
HTML
<p>This is a <a href="orig">linked hello</a>, a plain hello, another plain hello</p>
<p>This is a plain hello followed by a <a href="orig">linked hello</a></p>
JavaScript
$(document).ready(function() {
var needle = 'hello';
$('p').each(function() {
var me = $(this),
txt = me.html(),
found = me.find(needle).length,
regex = new RegExp('(' + needle + ')(?![^(<a.*?>).]*?<\/a>)','gi');
if (found != -1) {
txt = txt.replace(regex, '<a href="">$1</a>');
me.html(txt);
}
});
});