From: | Leif Biberg Kristensen <leif(at)solumslekt(dot)org> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: find and replace the string within a column |
Date: | 2010-09-24 14:39:07 |
Message-ID: | 201009241639.07557.leif@solumslekt.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tarlika Elisabeth Schmitz | 2010-09-24 16:12:26 | Re: identifying duplicates in table with redundancies |
Previous Message | Guillaume Lelarge | 2010-09-24 12:49:19 | Re: pgdump with insert command help |