Re: [PATCHES] regexp_replace

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

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?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-06-09 02:02:48 Re: I am up-to-date
Previous Message Bruce Momjian 2005-06-09 01:55:59 Re: [HACKERS] Should *.backup files ever be removed from pg_xlog?

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Flavel 2005-06-09 02:07:02 Re: [PATCHES] regexp_replace
Previous Message Bruce Momjian 2005-06-09 01:55:59 Re: [HACKERS] Should *.backup files ever be removed from pg_xlog?