Re: find and replace the string within a column - Mailing list pgsql-sql

From Craig Ringer
Subject Re: find and replace the string within a column
Date
Msg-id 4C9C8CB4.3070205@postnewspapers.com.au
Whole thread Raw
In response to find and replace the string within a column  (Nicholas I <nicholas.domnic.i@gmail.com>)
Responses Re: find and replace the string within a column  (Leif Biberg Kristensen <leif@solumslekt.org>)
List pgsql-sql
On 24/09/2010 5:15 PM, Nicholas I wrote:

> Example:
> table name person:
>
> name
> ------------------------------------
> Samuel (S/o Sebastin )
> -------------------------------------
>
> remove the word within the brackets.
> the output should be , Samuel.

Can't you just regexp_replace, matching \([^)]+\) (in other words "an 
open parenthisis, then a sequence of one or more of any character other 
than a close parenthesis, followed by a close parentheis) and replacing 
with an empty string ?

-- 
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/


pgsql-sql by date:

Previous
From: "Oliveiros d'Azevedo Cristina"
Date:
Subject: Re: identifying duplicates in table with redundancies
Next
From: Nicholas I
Date:
Subject: pgdump with insert command help