Re: [PATCHES] regexp_replace

From: Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, david(at)fetter(dot)org
Subject: Re: [PATCHES] regexp_replace
Date: 2005-06-10 12:10:14
Message-ID: PIEMIKOOMKNIJLLLBCBBGECMCIAA.a_ogawa@hi-ho.ne.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-06-10 13:45:32 Re: User Quota Implementation
Previous Message Junji TERAMOTO 2005-06-10 10:17:58 Re: Daily DBT-3 (DSS) Results on CVS head

Browse pgsql-patches by date

  From Date Subject
Next Message Atsushi Ogawa 2005-06-10 12:17:42 bugfix: character-code conversion of MIC -> EUC_JP.
Previous Message Andreas Pflug 2005-06-10 09:32:29 Server instrumentation