//JS 正则匹配 URL
var regexp = /((http|https):\/\/([\w\-]+\.)+[\w\-]+(\/[\w\u4e00-\u9fa5\-\.\/?\@\%\!\&=\+\~\:\#\;\,]*)?)/ig;
var urls = "http://www.baidu.com";
var url = urls.match(regexp);
if (url && typeof(url)!="undefined" && url!=0){
window.open(encodeURI(urls));
} else {
alert("url为空");
}