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

From Bruce Momjian
Subject Re: [PATCHES] regexp_replace
Date
Msg-id 200506090157.j591vTh11623@candle.pha.pa.us
Whole thread Raw
In response to Re: [PATCHES] regexp_replace  ("Andrew Dunstan" <andrew@dunslane.net>)
Responses Re: [PATCHES] regexp_replace
Re: [PATCHES] regexp_replace
List pgsql-hackers
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@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: The Contrib Roundup (long)
Next
From: Bruce Momjian
Date:
Subject: Re: I am up-to-date