Re: find and replace the string within a column

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Nicholas I <nicholas(dot)domnic(dot)i(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: find and replace the string within a column
Date: 2010-09-24 11:34:12
Message-ID: 4C9C8CB4.3070205@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Nicholas I 2010-09-24 12:32:45 pgdump with insert command help
Previous Message Oliveiros d'Azevedo Cristina 2010-09-24 10:22:21 Re: identifying duplicates in table with redundancies