This following JavaScript function helps you to check whether the domain name is valid or not using RegExp.
function IsvalidDomain(domainName) {
if (domainName!= null && domainName!= undefined) {
var pattern = new RegExp(/[^w{3}.]([a-zA-Z0-9]([a-zA-Z0-9-]{0,65}[a-zA-Z0-9])?.)+[a-zA-Z]{2,6}/igm);
return pattern.test(domainName);
}
else {
return false;
}
}