I'm trying to create a domain name validation using jquery I want to allow all domain name inside that regex validation e.g.
www.abcd.xxx valid
www.abcd.xx.xx valid
What I'm trying to do is here is my code and regex :
$.validator.addMethod("customurl",
function (value, element) {
return /(?:https?:\/\/)?(?:www\.)?[a-z-]+\.(?:com|co.uk)(?:\.[a-z]{2,3})?/.test(value);
},
"Invalid url format"
);
what above code will do is allow only .com and .co.uk domains but I want to allow for all it could be .org, .nl, .in, co.uk, .edu etc.
Can you guys please help me out with this.
Thanks Randheer