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