Re: regexp_replace() function in new version

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: Abhijeet <abhijeetrathod262(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: regexp_replace() function in new version
Date: 2007-11-18 01:53:27
Message-ID: dcc563d10711171753rde8df1fl668dbf9495404dda@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Nov 14, 2007 7:53 AM, Abhijeet <abhijeetrathod262(at)gmail(dot)com> wrote:
> Hi,
>
> regexp_replace() function in new version of PostgreSQL is giving error.
>
> I am trying to remove tags from string.
>
> I have tried following regex in & function:
>
> SELECT regexp_replace('<i>Abhijeet</b>',
> '<(\s)*/?(?i:script|i|b|u|embed|object|a|frameset|frame|iframe|meta|link|style|table|th|td|tr|tbody|input|select|option|form|map|area|!--)(.|\n)*?>',
> '\&\s');
> cc SELECT regexp_replace('<i>Abhijeet</b>', '<
> */?(?i:script|i|b|u|embed|object|a|frameset|frame|iframe|meta|link|style|table|th|td|tr|tbody|input|select|option|form|map|area|!--)(.|\n)*?>',
> '\& ' ); Both these try giving me error as follows:
>
>
> WARNING: nonstandard use of escape in a string literal at character 42
> HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
> WARNING: nonstandard use of escape in a string literal at character 192
> HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
> ERROR: invalid regular expression: quantifier operand invalid can anyone
> suggest me why is that error ocurring?

I think PostgreSQL is telling what's happening in the hint there. Put
an E in front of your strings if you're going to have escapes in them.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2007-11-18 02:00:35 Re: ERROR: invalid restriction selectivity: 224359728.000000
Previous Message Ted Byers 2007-11-17 22:19:17 Re: Need help with complicated SQL statement