I\'m currently using the following code, to search the a div on a page for URLs and replace them with a tags.
However when we have a embed tags within the div it me
+1 to what Johannes says...
$(document).ready(function(){
$('div.content').contents().filter(function() {
return this.nodeType == 3;
}).each(function(){
this.nodeValue.replace(/(ftp|http|https|file):\/\/[\S]+(\b|$)/gim,'$&').replace(/([^\/])(www[^ <]+(\b|$))/gim,'$1$2');
});
});
Note the code above is untested but it should look something like that i believe.