c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
JQuery

How to validate domain name using jQuery ?

| | JavaScript , JQuery

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;
        }
    }