Re: regexp_replace

From: "Pawel Socha" <pawel(dot)socha(at)gmail(dot)com>
To: "Marcin Krawczyk" <jankes(dot)mk(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: regexp_replace
Date: 2008-08-01 12:14:35
Message-ID: cc4f12900808010514id77c27dr7c91613f2b19005c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2008/8/1 Marcin Krawczyk <jankes(dot)mk(at)gmail(dot)com>

> Hi all. I'd like to know whether it's possible to reverse the
> behaviour of regexp_replace, meaning :
> now if I do
> SELECT regexp_replace ('foobarbaz', 'b..', 'X') I get 'fooXbaz' - it
> replaces the string that matches given pattern with 'X', how do I
> achieve the opposite - replace the string that doesn't match the
> pattern ?
>
> regards
> mk
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

merlin=# SELECT regexp_replace ('foobarbaz', '[^b]', 'X', 'g');
regexp_replace
----------------
XXXbXXbXX
(1 row)

--
--
Serdecznie pozdrawiam

Pawel Socha
pawel(dot)socha(at)gmail(dot)com

programista/administrator

perl -le 's**02).4^&-%2,).^9%4^!./4(%2^3,!#+7!2%^53%2&**y%& -;^[%"`-{
a%%s%%$_%ee'

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Marcin Krawczyk 2008-08-01 12:25:32 Re: regexp_replace
Previous Message Marcin Krawczyk 2008-08-01 11:22:40 regexp_replace