Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B4F189F9645 for ; Wed, 12 Sep 2007 09:52:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 42215-04 for ; Wed, 12 Sep 2007 09:52:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id D426F9F9644 for ; Wed, 12 Sep 2007 09:52:17 -0300 (ADT) Received: from perhan.alvh.no-ip.org ([190.95.8.15]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l8CCq5n9020415; Wed, 12 Sep 2007 05:52:06 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 5FEFC47C65; Wed, 12 Sep 2007 08:52:03 -0400 (CLT) Date: Wed, 12 Sep 2007 08:52:03 -0400 From: Alvaro Herrera To: Paul Lambert Cc: sql pgsql Subject: Re: Extracting hostname from URI column Message-ID: <20070912125203.GC4979@alvh.no-ip.org> References: <335491.75226.qm@web54303.mail.re2.yahoo.com> <46E73D1C.4020009@autoledgers.com.au> <46E7510C.1090807@autoledgers.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <46E7510C.1090807@autoledgers.com.au> User-Agent: Mutt/1.5.16 (2007-06-11) X-Virus-Scanned: ClamAV 0.91.1/4255/Wed Sep 12 00:18:47 2007 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Wed, 12 Sep 2007 05:52:07 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/99 X-Sequence-Number: 29312 Paul Lambert wrote: > Andrej Ricnik-Bay wrote: > >> Plain regex.... The key are the parenthesis () ... >> basically it will omit ANYTHING + two slashes at the beginning >> of a string. Then it will match everything BUT a slash, and as >> much of that as possible since regex are greedy by default >> (hence the host name he was looking for) ... and everything >> AFTER a slash will be omitted. >> Cheers, >> Andrej > Thanks - that makes a bit more sense. I'm in the middle of reading chapter > 9.3.7 of the manual - POSIX Regular Expressions - which I'm assuming is > dealing with this, so it's looking clearer. A very good resource on regular expressions is "Mastering Regular Expressions" by Jeffrey Friedl, now in its third edition: http://www.oreilly.com/catalog/regex3/ I read the first ed. years ago and it was very illuminating. -- Alvaro Herrera Developer, http://www.PostgreSQL.org/ "Acepta los honores y aplausos y perderás tu libertad"