JavaScript Regex Get Domena z URL

function url_domain(data) {
  var    a      = document.createElement('a');
         a.href = data;
  return a.hostname;
}
Sators