// location.search var str = "?http://exam.com"; var zone = /(?:http:\/\/)?\w+\.(\w+)/.exec(str)[1]; alert(zone)