Re: [PATCHES] regexp_replace

From: Tom Flavel <tom(at)printf(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] regexp_replace
Date: 2005-06-09 02:07:02
Message-ID: 20050609020702.GB12557@printf.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On 08/06/2005 21:57:29, Bruce Momjian wrote:
> Andrew Dunstan wrote:
> > Atsushi Ogawa said:
> > >
> > > How about changing the function name of each usage?
> > >
> > > regexp_replace: replace first
> > > regexp_replace_all: replace all
> > > regexp_ic_replace: replace first and case insensitive
> > > regexp_ic_replace_all: replace all and case insensitive
> >
> >
> > That's just horrible. The number of function names will double with each
> > supported flag (e.g. I'd like to see extended regexes supported).
> >
> > 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.

--
Tom

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-06-09 02:11:57 Re: Request for support for GIST enhancements
Previous Message Bruce Momjian 2005-06-09 02:02:48 Re: I am up-to-date

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-06-09 02:29:20 Re: ALTER SCHEMA ... SET TABLESPACE
Previous Message Bruce Momjian 2005-06-09 01:57:29 Re: [PATCHES] regexp_replace