Search Postgresql Archives

Re: [Urgent] Regexp_replace question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 25, 2007 at 01:36:26PM +0800, Phoenix Kiula wrote:
> How can I remove characters that form a part of regular expressions?

Why do you want to do that?

> I would like to remove all instances of the following characters:
> 
> [
> ]
> \
> +

test=> select id, t, regexp_replace(t, e'[\\\\[\\]+]', '', 'g') from foo;
 id |     t      | regexp_replace 
----+------------+----------------
  1 | foo[]+\bar | foobar
(1 row)

test=> select id, t, translate(t, e'[]\\+', '') from foo;
 id |     t      | translate 
----+------------+-----------
  1 | foo[]+\bar | foobar
(1 row)

-- 
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux