This is a Regular Expression that I used to check validity for a domain entered by a user. It covers the top domains which the particular service covered and you should change it for your own top domains.
If you need a RegExp that matches all valid domains, including all top domains and all subdomains, there is a good attempt (no support for special characters such as åäö) here.
Here is the code:
Hope it’s of any use to someone!