pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gregory Stark <stark@enterprisedb.com>
To: Paul Lambert <paul.lambert@autoledgers.com.au>
Cc: sql pgsql <pgsql-sql@postgresql.org>
Subject: Re: Extracting hostname from URI column
Date: Mon, 17 Sep 2007 00:18:56 +0100
Message-ID: <873axekxlr.fsf@oxford.xeocode.com> (raw)
In-Reply-To: <46EDB43D.9060405@autoledgers.com.au>
References: <335491.75226.qm@web54303.mail.re2.yahoo.com>
	<46E73D1C.4020009@autoledgers.com.au>
	<46EDB43D.9060405@autoledgers.com.au>

"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



view thread (17+ messages)  latest in thread

Message-ID: <873axekxlr.fsf@oxford.xeocode.com>
Permalink:  ../873axekxlr.fsf@oxford.xeocode.com/
Also on:    postgresql.org/message-id/873axekxlr.fsf@oxford.xeocode.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: stark@enterprisedb.com, paul.lambert@autoledgers.com.au
  Subject: Re: Extracting hostname from URI column
  In-Reply-To: <873axekxlr.fsf@oxford.xeocode.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox