I am having JavaScript as follows
function DomainValidation() {
var val = document.getElementById('<%=txtDomainName.ClientID %>').value;
if (/^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$/.test(val)) {
return true;
}
else {
alert("Enter Valid Domain Name");
return false;
}
}
for checking the valid domain name. It is working fine except when I try to enter the domain name with only two character it is not accepting. Since I have no idea of using Regular Expression, so wanna know where I should make change so that it accept domain name with only two characters also.
Note:- Before marking this a duplicate and showing me this I would like to inform that the above script is working fine but I want it to accept the domain name with only two characters too.