From: | Jeremy Drake <pgsql(at)jdrake(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, David Fetter <david(at)fetter(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>, Neil Conway <neilc(at)samurai(dot)com> |
Subject: | Re: patch adding new regexp functions |
Date: | 2007-02-18 00:10:20 |
Message-ID: | Pine.BSO.4.64.0702171602390.18849@resin.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
On Sat, 17 Feb 2007, Tom Lane wrote:
> Jeremy Drake <pgsql(at)jdrake(dot)com> writes:
> > 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
>
> > For this function, it would be setof array of text, as the capture groups
> > would definitely go in an array, but if you asked for global in the flags,
> > there could be more than one match in the string.
>
> Oh, right. And you could do a 2-D array if you wanted it all in one
> blob (or a guarantee of order).
I don't think that there is much of an argument for having this one return
a 2d array, in this particular case, even perl requires you to build a
loop, IIRC.
my $str = 'foobarbecuebazilbarf';
while($str=~/(b[^b]+)(b[^b]+)/g) {
print $1, "\t", length($1), "\n";
print $2, "\t", length($2), "\n";
print "---\n";
}
bar 3
becue 5
---
bazil 5
barf 4
---
> So no need for record-returning functions?
No.
--
Go placidly amid the noise and waste, and remember what value there may
be in owning a piece thereof.
-- National Lampoon, "Deteriorata"
From | Date | Subject | |
---|---|---|---|
Next Message | Chad Wagner | 2007-02-18 00:43:23 | Re: New feature request: FlashBack Query |
Previous Message | elein | 2007-02-18 00:06:32 | Re: New feature request: FlashBack Query |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2007-02-18 01:35:02 | Re: patch for contrib/xml2 |
Previous Message | Tom Lane | 2007-02-17 19:43:14 | Re: patch adding new regexp functions |