Re: greedy preg

From: Date: Thu, 07 Aug 2003 08:50:58 +0000
Subject: Re: greedy preg
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158624@lists.php.net to get a copy of this message
> Not sure if I understand you correct but > the way you wrote your replace pattern the result should be > <news></news>. > If you want just the file to be replaced you have to use something like > preg_replace("|<item>.*?($file).*?</item>|si",'\\1',$contents) > no, i want just the whole <item></item> replaced for that particular file. the pattern i wrote shouldn't... doesn't touch the <news> section at all. wouldn't the pattern you wrote replace the whole <item></item> with the file tho?

« previous php.general (#158624) next »