regex to extract domain name from url javascript code example
Example: javascript regex get domain from url
function url_domain(data) {
var a = document.createElement('a');
a.href = data;
return a.hostname;
}
function url_domain(data) {
var a = document.createElement('a');
a.href = data;
return a.hostname;
}