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