substring and POSIX re's

From: Don Isgitt <djisgitt(at)soundenergy(dot)com>
To: postgresql general <pgsql-general(at)postgresql(dot)org>
Subject: substring and POSIX re's
Date: 2005-04-19 15:19:34
Message-ID: 42652186.5050306@soundenergy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi.

First: PG version 7.4 and 8.0.

I have a question regarding the following simplified query:

gds2=# select substring('NE NE SE 2310 FSL 330 FEL' from '^([A-Z][A-Z] )+');
substring
-----------
SE
(1 row)

The pg docs say that this form of substring uses POSIX re's, and my
understanding of POSIX re's is they are always greedy. So, why do I get
only SE instead of NE NE SE? Pilot error, probably, but would someone
please enlighten me? Thank you very much.

Don

p.s. The target string can have from 1 to 6 of the 2 char strings, not
just 3 as shown in this example.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Schuchardt 2005-04-19 15:24:22 What means Postgres?
Previous Message Michael Fuhr 2005-04-19 15:18:18 Re: Datatypes in PL/PSQL functions with multiple arguments