I would like to match just the root of a URL and not the whole URL from a text string. Given:
http://www.youtube.co
String.prototype.trim = function(){return his.replace(/^\s+|\s+$/g,"");} function getHost(url){ if("undefined"==typeof(url)||null==url) return ""; url = url.trim(); if(""==url) return ""; var _host,_arr; if(-1