Re: regular expression substittion function?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: regular expression substittion function?
Date: 2001-02-15 16:29:24
Message-ID: 20010215102924.A30868@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 15, 2001 at 10:59:11AM -0500,
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> > Are there any plans to provide a regular expression substitution function,
> > similar to translate but allowing more complex substitutions?
>
> Not in Postgres itself. Either pltcl or plperl offers you far better
> text-mashing facilities than we could provide as SQL functions, so I
> don't really see the point in partially duplicating their functionality.

I tried to explain that in the message. Because I was doing a union
where some of the data needed to be changed, deferring the substitution
until after the rows were returned wasn't simple.

There are three ways I can handle things correctly. One is to split the
queries and combine the results in perl. I didn't do this originally
because there was no guarenty that either part of the union would return
any rows and I wanted to do something different if there weren't any
returned rows. That isn't an issue currently.

The second way that I could do things would be to mark what parts of the
returned url still needed to be quoted. Splitting the returned url into
3 columns with the middle one getting quoted would work in my situation.

The third was that since I really wanted to drop characters that would
be encoded as multiple characters, I could use a complicated
(and typo prone) translate call to handle the quoting problem.

It just seemed that things would be simpler to write and understand if
I could have used a perl like substitution function. I thought if other
people could use something like this that maybe it was something that
should get added to postgresql.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2001-02-15 16:30:09 Re: regular expression substittion function?
Previous Message David Wheeler 2001-02-15 16:28:55 Re: Case insensitive selects?