function linkUrl(str){ var reg = /((http\:\/\/)?(\w+\.)+(\w{2,3}))\b/g; return str.replace(reg , '<a target=_blank href="$1"> $1 </a>' ); }