Re: find and replace the string within a column
| От | Leif Biberg Kristensen |
|---|---|
| Тема | Re: find and replace the string within a column |
| Дата | |
| Msg-id | 201009241639.07557.leif@solumslekt.org обсуждение исходный текст |
| Ответ на | Re: find and replace the string within a column (Craig Ringer <craig@postnewspapers.com.au>) |
| Список | 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
В списке pgsql-sql по дате отправления: