I have seen a similar question asked here Jquery how to validate domain name but I cannot seem to get this example to work with my code.
I would basically like to perform a reg ex against an input text box, and validate via jquery to see if it matches my search criteria for a domain name. The format must be
domainname.co.uk or .com/.org/.net (no http:// or https:// and no subdomain)
My code currently :
if(!/([a-z0-9-]+\.(?:com|net|org|co.uk))(?:\/|$)/$("#domain").val()) {
$('#error').html("Invalid domain name, , please correct before proceeding.");
return false;
}