Code Smarter, Not Harder.

Need code that works? Grab a snippet. Made something cool? Share it back. Simple as that.

^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$
 
# Valid domain names
example.com
sub.example.co.uk
example-domain.com
subdomain.example.com
 
# Invalid domain names
-example.com
example..com
example.c
Domain Name