var re = /(https?|ftp):\/\/\S+[^\s.,> )\];'\"!?]/;
var subst = '<a href="$&" target="_blank">$&</a>';
var withlink = textownstr.replace(re, subst);
var re = /([^\"=]{2}|^)((https?|ftp):\/\/\S+[^\s.,> )\];'\"!?])/;
var subst = '$1<a href="$2" target="_blank">$2</a>';
var withlink = textownstr.replace(re, subst);