Re: Extracting hostname from URI column - Mailing list pgsql-sql

From Gregory Stark
Subject Re: Extracting hostname from URI column
Date
Msg-id 873axekxlr.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Extracting hostname from URI column  (Paul Lambert <paul.lambert@autoledgers.com.au>)
Responses Re: Extracting hostname from URI column
List pgsql-sql
"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


pgsql-sql by date:

Previous
From: Paul Lambert
Date:
Subject: Re: Extracting hostname from URI column
Next
From: "Stanislas de Larocque"
Date:
Subject: Re: Optimize querry sql