Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: OWA_PATTERN to remove any html

Re: OWA_PATTERN to remove any html

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: 23 Apr 2003 17:57:31 GMT
Message-ID: <b86k6a$70plc$1@ID-82536.news.dfncis.de>

> Hi all,
>
> I'm trying to express a regular expression to remove any html in a given
> varchar2 variable. I've found the regular expression to do this in perl.
> It's:
>
> $OnlyContent =~ s{<([^>])+>|&([^;])+;}{}gsx;
>
> When I try to use this regular expression in PL/SQL I get the command:
>
> L_source := '<html><body><b>test</b><a
> href="http://www.test.com">something</a></body></html>';
> L_count := OWA_PATTERN.CHANGE(L_source, '<([^>])+>|&([^;])+;', '', 'gi');
>
> Every time I try to execute this, I get the following errors:
> ORA-06502: PL/SQL: numeric or value error: character to number conversion
> error
> ORA-06512: at "SYS.OWA_PATTERN", line 444
> ORA-06512: at "SYS.OWA_PATTERN", line 579
> ORA-06512: at "SYS.OWA_PATTERN", line 1120
>
> Could anybody tell me, what's wrong with the regular expression or how I
> could express a regular expression which removes any html in a given
> varchar2???
>

Ingo

I have the hunch that | is not supported in OWA_PATTERN's RE. Also, I have the feeling that the paranthesis can be omitted.

The following seems to work here:

declare   

  L_source varchar2(200);
  L_count number;

begin

  L_source :=
  '<html><body><b>test</b>something</body></html>';

  L_count := OWA_PATTERN.CHANGE(L_source, '<[^>]+>','','gi');   L_count := OWA_PATTERN.CHANGE(L_source, '\&[^;]+;', '', 'gi');

  dbms_output.put_line(L_source);
end;
/

hth

Rene Nyffenegger

-- 
  Projektleitung und Entwicklung in Oracle/C++/C# Projekten
  http://www.adp-gmbh.ch/cv.html
Received on Wed Apr 23 2003 - 12:57:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US