I need a regex to be able to validate a domain name without http:// or https://
What I mean:
Valid Should Be:
domain.com
domain.fr
domain.it
domain.whateverelse
subdomain.domain.com
subdomain.doamin.fr
subdomain.domain.whateverelse
Invalid Should Be:
domain
http://domain.com
https://domain.com
https://domain.whateverelse
http://subdomain.domain.com
http://subdomain.domain.fr
http://subdomain.domain.whateverelse
This is what I came so far:
(http(s)?://)?([\w-]+\.)+[\w-]+[.com]+(/[/?%&=]*)?
For example the regex above considers domain.whatever as invalid ... so basically works just with .com