filter top domain in string 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;
}