Re: patch adding new regexp functions - Mailing list pgsql-patches

From Jeremy Drake
Subject Re: patch adding new regexp functions
Date
Msg-id Pine.BSO.4.64.0702172207530.18849@resin.csoft.net
Whole thread Raw
In response to Re: patch adding new regexp functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: patch adding new regexp functions  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-patches
Attached, please find a new version of the patch which follows Tom's
advice (except regexp_matches returing a 2-D array, which I am not sure if
it is required/desired).  Hopefully this version makes everyone happy ;)

On Sat, 17 Feb 2007, Tom Lane wrote:

> So I'd vote against complicating the API in order to make special
> provision for these results.  I claim that all we need is a function
> taking (string text, pattern text, flags text) and returning either
> array of text or setof text containing the matched substrings in
> whatever order is standard (order by left-parenthesis position,
> I think).  In the degenerate case where there are no parenthesized
> subpatterns, just return the whole match as a single element.

The signature is

regexp_matches(string text, pattern text[, flags text]) returns setof
text[]

and behaves as described.

>
> As for the argument about array vs setof, I could see doing both to
> end the argument of which one is really superior for any particular
> problem.

regexp_split(string text, pattern text[, flags text]) returns setof text

regexp_split_array(string text, pattern text[. flags text[, limit int]])
returns text[]


--
When I was in school, I cheated on my metaphysics exam:
I looked into the soul of the boy sitting next to me.
        -- Woody Allen

Attachment

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [BUGS] BUG #2977: dow doesn't conform to ISO-8601
Next
From: Greg Smith
Date:
Subject: Re: WIP patch - INSERT-able log statements