SHOULD PASS:

example.com   PASS
example-domain.com   PASS
sub-domain.example.com   PASS
www.example.com   PASS
example.co.uk   PASS
multi.domain.e-xample.co.uk   PASS
14example.com   PASS
14.example.com   PASS
x.com   PASS
ExAmPlE.CoM   PASS
wWw.ExAmPlE.CoM   PASS
example.c2m   PASS
example.2m   PASS

SHOULD FAIL:

http://.com   FAIL
example.com:8080   FAIL
.com   FAIL
examplecom   FAIL
example..com   FAIL
e--xample.com   FAIL
exam%ple.com   FAIL
example.c-com   FAIL
-example.com   FAIL
.example.com   FAIL
example-.com   FAIL
example.-domain.com   FAIL
com.x   FAIL
http://www.example.com   FAIL
example domain.com   FAIL
example.---   FAIL
example.2   FAIL
  FAIL
  FAIL
1   FAIL
  FAIL
1   FAIL

Note: The last five fail tests are an empty string, false, true (shows as 1), null and 1.