Re: ereg_replace

From: Date: Mon, 09 Jul 2001 13:02:57 +0000
Subject: Re: ereg_replace
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-10178@lists.php.net to get a copy of this message
> >What I'm doing is using ereg_replace in this form: > >$LargeString = ereg_replace("<tag>.*</tag>", > >"replacement", "$LargeString"); > >but what I get is the string with the replacement in a > >way I don't actually want. It replaces the part of the > >string that begins with THE FIRST TAG <tag> and that > >ends with THE LAST TAG </tag>. Use preg_raplace and make it "ungreddy" using "?" : $LargeString = preg_replace("|<tag>.*?</tag>|","replacement", $LargeString); Regards, Soeren

« previous php.db (#10178) next »