Re: What's wrong with this code?

From: Date: Mon, 21 May 2001 13:27:37 +0000
Subject: Re: What's wrong with this code?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-53710@lists.php.net to get a copy of this message
In article <9eb4nf$pdf$1@toye.p.sourceforge.net>, aemuli@spamclause.yahoo.com ("Plutarck") wrote: > $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. pregs are greedy by default, while eregs are ungreedy by default. If you make your preg ungreedy (using the "U" modifier), do you get a result more consisent with the ereg's? -- CC

« previous php.general (#53710) next »