I\'ve seen similar questions asked before, but none with a working solution.
I am trying to replace all urls on a page with anchor tags, but only those which aren\'t alr
If you are doing it on the client-side it might be worth doing it by walking document tree
Look through text nodes (nodeName="#text") and if there is substring starting with http/https and parent tag is not A - replace it with pattern (\1 etc)
consider this to start
// getting all tags where there is a text with 'http' which are not links
var textTags = [].slice.call(document.getElementsByTagName('*'))
.filter(function(n) {
return !n.children.length
&& n.nodeName !='A' && n.nodeName !='INPUT'
&& (n.innerHTML.indexOf('http') > -1) })
for(var i in textTags) {
// your code to replace links with whatever you want
}