Hiya Plutarck,

The .*'s are greedy.  Maybe you should do something like this (not tested):

$file = preg_replace("/(<script)([^>])*([^<])*(<\/script>)/i", "<!-- RWW:
Scripting killed -->", $file);

That should replace something like:

<script language="Javascript">Some (code not<) </script>

with
<!-- RWW: Scripting killed -->

James.

""Plutarck"" <[EMAIL PROTECTED]> wrote in message
9eb4nf$pdf$[EMAIL PROTECTED]">news:9eb4nf$pdf$[EMAIL PROTECTED]...
> I'm creating a filter to re-write webpages, and everything is going fine.
> I'm trying to strip out anything using the <SCRIPT> tag, and here's what I
> know works:
>
> $file = eregi_replace("<script.*>.*</script>", "<!-- RWW: Scripting
> killed -->", $file);
>
> But I use PCRE functions, so I don't want to use ereg in one place and
PCRE
> in another, so I tried:
>
> $file = preg_replace("#<script.*>.*</script>#i", "<!-- RWW: Scripting
> killed -->", $file);
>
> Thing is, that doesn't work. And I don't know why.
>
> I assume that the brackets are what is causing the trouble, but what do
> those brackets do in PCRE that requires they be escaped? But escaping them
> doesn't seem to work either...
>
> So, what's wrong with the second piece of code that isn't wrong in the
> first?
>
>
> Thanks in advance.
>
> Plutarck
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to