Regex - check is domain is correct
In my project in work, I had to write validation function to check domain syntax. I did it using regex expression certainly, hope it help:

    var IsDomainCorrect = function (domain) {
       if (domain !== "") {
          var pattern = new RegExp(/^((www)\.([a-z0-9])+\.([a-z])+)/);
          return pattern.test(domain);
       }
       else {
         return true;
       }
    };
Regex - check is domain is correct
===

In my project in work, I had to write validation function to check domain syntax. I did it using regex expression certainly, hope it help:

    var IsDomainCorrect = function (domain) {
       if (domain !== "") {
          var pattern = new RegExp(/^((www)\.([a-z0-9])+\.([a-z])+)/);
          return pattern.test(domain);
       }
       else {
         return true;
       }
    };