How can I allow users to enter both subdomain and domain names without the http:// prefix using a regex in javascript. I need to allow: domainname.com or www.domainname.com or www.domainname.co.uk. I have this at the moment which expects www. :
/^(?=www\.)[A-Za-z0-9_-]+\.+[A-Za-z0-9.\/%&=\?_:;-]+$/ix.test(value);