"Paul Lambert" <paul.lambert@autoledgers.com.au> writes:
> What would be the best way to do something like that? I assume it won't be a
> simple regex like the above due to the country codes on the end of some
> domains. My thought is look at the last portion of the domain, if it's 2
> characters long then assume it's a country code and grab the last three
> sections, if it's not three characters long then assume it's an international
> domain and grab the last two... but that sounds a bit dodgy.
Not all countries break up their national tld space into sections like .co.uk
or .com.au. Canadian domains can be bought directly under .ca like amazon.ca.
I think you'll have to store a specific list of tlds and how deep you want to
look.
-- Gregory Stark EnterpriseDB http://www.enterprisedb.com