Re: [PATCHES] regexp_replace - Mailing list pgsql-hackers

From Atsushi Ogawa
Subject Re: [PATCHES] regexp_replace
Date
Msg-id PIEMIKOOMKNIJLLLBCBBGECMCIAA.a_ogawa@hi-ho.ne.jp
Whole thread Raw
In response to Re: [PATCHES] regexp_replace  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [PATCHES] regexp_replace
List pgsql-hackers
Tom Flavel wrote:
> On 08/06/2005 21:57:29, Bruce Momjian wrote:
> > Andrew Dunstan wrote:
> > >
> > > surely somthing like
> > >
> > >   foo_replace (source text, pattern text, replacement text, flags
text)
> > > returns text
> > >
> > > would fit the bill. OK, it reflects my Perl prejudices, but that
> > > looks more natural to me. You could overload it so that the flags
> > > default to none
> > > (which would be case sensitive, replace the first instance only,
> > > among other things).
> >
> > Can we have the flags be a list of words, e.g.  "all, ignorecase".  How
> > do we handle this type of problem in other cases?
>
> How about an array?
>
> Cumbersome, perhaps, but it makes more sense to me than delimiting with
> commas or using single characters.

I think that it is good to specify the flags by one character as well
as Perl.

I propose the following specification:

regexp_replace(source text, pattern text, replacement text, [flags text])
returns text

The flags can use the following values:g: global (replace all)i: ignore case

When the flags is not specified, case sensitive, replace the first
instance only.

regards,

---
Atsushi Ogawa



pgsql-hackers by date:

Previous
From: Junji TERAMOTO
Date:
Subject: Re: Daily DBT-3 (DSS) Results on CVS head
Next
From: Bruce Momjian
Date:
Subject: Re: User Quota Implementation