What's wrong with this code?

From: Date: Mon, 21 May 2001 13:24:29 +0000
Subject: What's wrong with this code?
Groups: php.general 
Request: Send a blank email to php-general+get-53708@lists.php.net to get a copy of this message
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

« previous php.general (#53708) next »