Why not use URI? It will tell you what you need to know:
my ($uri) = new URI("http://www.mydomain.com.au/test.html");
print $uri->host,"\n";
It's probably far better to use that than a regexp, though,
of course, you would not be able to validate the validity
of any given Top Level Domain (TLD).
It used to be that top level domains (TLDs) were for countries
(i.e. ".ca", ".au", ".uk") or types of companies (".com",
".net", ".org", or even ".mil") and were fairly predictable.
These days, with countries being invaded and assimilated,
or spliting up because of civil war (frighteningly
frequent in Eastern Europe), the TLDs are always changing.
The
ISO-3166
specifies the country codes for various national entities.
Added to this is the likes of Esther Dyson, chairperson of
ICANN, which is proposing
to add things like ".museum" to the TLD namespace.
Don't forget the
UTF-5 encoded "iTLDs" which are being
issued by
VeriSign
and others. These look really wacky unless your browser
supports them, but they mean things like ".com" in Japanese,
Chinese, Korean, and other languages that aren't based on
the Latin character set.
The only way to know for sure, if only for a short period of
time (i.e. a month or so) before requiring an update, is to
process the root zone file which lists all the servers
for all the active domains.