pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Leif Biberg Kristensen <leif@solumslekt.org>
To: pgsql-sql@postgresql.org
Subject: Re: find and replace the string within a column
Date: Fri, 24 Sep 2010 16:39:07 +0200
Message-ID: <201009241639.07557.leif@solumslekt.org> (raw)
In-Reply-To: <4C9C8CB4.3070205@postnewspapers.com.au>
References: <AANLkTi=yv6typUZDxhOjufJj2jua=OXb7cM8Lq86tRuv@mail.gmail.com>
<4C9C8CB4.3070205@postnewspapers.com.au>
On Friday 24. September 2010 13.34.12 Craig Ringer wrote:
> 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 ?
I'm doing a similar task, removing comments "hidden" within curly braces like
this:
str := REGEXP_REPLACE(str, '{.*?}', '', 'g');
No escaping needed at all.
regards,
Leif Biberg Kristensen
view thread (4+ messages)
Message-ID: <201009241639.07557.leif@solumslekt.org> Permalink: ../201009241639.07557.leif@solumslekt.org/ Also on: postgresql.org/message-id/201009241639.07557.leif@solumslekt.org ·
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: leif@solumslekt.org Subject: Re: find and replace the string within a column In-Reply-To: <201009241639.07557.leif@solumslekt.org> * 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