[Urgent] Regexp_replace question

From: "Phoenix Kiula" <phoenix(dot)kiula(at)gmail(dot)com>
To: "Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: [Urgent] Regexp_replace question
Date: 2007-09-25 05:36:26
Message-ID: e373d31e0709242236g242332f6q71b835d78209badb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

How can I remove characters that form a part of regular expressions? I
would like to remove all instances of the following characters:

[
]
\
+

Given that these all mean something in regexp, I am trying to prefix
them with a backslash, but it doesn't work. I tried the following:

update TABLE
set COLUMN = regexp_replace(COLUMN, E'[\\\[\]\+]+', '')
;

This did not work so I tried the naked characters separated by a pipe,
as follows:

update TABLE
set COLUMN= regexp_replace(COLUMN, E'[\|[|]|+]+', '')
;

But this of course did not work either. I've read and re-read the
pattern matching doc page ( http://snipurl.com/pg_regexp ) but it
doesn't seem to offer much help.

Any thoughts on what I am doing wrong?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Conal 2007-09-25 05:41:44 Poor performance with ON DELETE CASCADE
Previous Message Richard Broersma Jr 2007-09-25 05:18:37 Re: Why the ERROR: duplicate key violates uniqueconstraint "master_pkey" is raised? - Is this a Bug?