Check Domain Name Syntax with JS

Hello,

I would like to use JavaScript to determine the syntax validity of a domain name. This will be used in an internal Intranet, so in addition to all standard domain name extensions, other internal extensions should be allowed as well.

1. There should be at least 1 dot.
2. Only letters, numbers and dashes should be allowed before the LAST dot.
3. Only letters should be allowed AFTER the LAST dot.
4. This should be case insensitive

All of these should PASSwww.example.comwww.example.intranet
sub.portal.example.intranet
example-web-page-123.mobi
2534457.2343.com
234-64.23.112.intrra
234-64.23.112.2323.5234.34323.43234.234.net

But all of these should FAIL:
example com
example@example.com
sub_portal.example.intranet
example-web-page-123
192.168.0.1