Re: regexp replace?

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: CSN <cool_screen_name90001(at)yahoo(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: regexp replace?
Date: 2004-05-06 21:19:26
Message-ID: Pine.LNX.4.33.0405061518550.5920-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 6 May 2004, CSN wrote:

> I'd like to create a function that will take strings
> like:
>
> abcdef 'quote1' "quote2" / xyz etc.
>
> and return:
>
> abcdef-quote1-quote2-xyz-etc.
>
> Basically remove all characters that aren't
> [A-Za-z0-9], -, or ., and replace all spaces with
> hyphens. Possible? The only string function that
> supports regular expressions is substring and I
> couldn't make that do what I want.

I think translate may be able to do what you want pretty handily. May
take two passes, i.e. a subselect.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2004-05-06 21:44:21 Re: 7.2 or 7.4 for critical data?
Previous Message Kevin DeGraaf 2004-05-06 21:16:15 creation permissions when moving from 7.2 -> 7.4