pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Nicholas I <nicholas.domnic.i@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: find and replace the string within a column
Date: Fri, 24 Sep 2010 19:34:12 +0800
Message-ID: <4C9C8CB4.3070205@postnewspapers.com.au> (raw)
In-Reply-To: <AANLkTi=yv6typUZDxhOjufJj2jua=OXb7cM8Lq86tRuv@mail.gmail.com>
References: <AANLkTi=yv6typUZDxhOjufJj2jua=OXb7cM8Lq86tRuv@mail.gmail.com>

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/



view thread (4+ messages)  latest in thread

Message-ID: <4C9C8CB4.3070205@postnewspapers.com.au>
Permalink:  ../4C9C8CB4.3070205@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4C9C8CB4.3070205@postnewspapers.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: craig@postnewspapers.com.au, nicholas.domnic.i@gmail.com
  Subject: Re: find and replace the string within a column
  In-Reply-To: <4C9C8CB4.3070205@postnewspapers.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox