Re: greedy preg

From: Date: Wed, 06 Aug 2003 22:35:27 +0000
Subject: Re: greedy preg
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-158577@lists.php.net to get a copy of this message
skate wrote:
What are the possible values of $file? Are you looking to replace just a specific occurance of a $file between <item> tags? Maybe this will help: $contents = preg_replace("|<item>[^<]*$file[^<]*</item>|si","",$contents); or just use the 'U' modifier for "ungreedy"...
i'm looking to replace the entire <item>....</item> for that respective file. the file will have a value of whichever file that record points to, and will be unique (xml/news/12312312.xml) should .*? not be ungreedy tho?
Yeah, it should be. What kind on content can be around $file and also within the <item> tag? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals – www.phparch.com

« previous php.general (#158577) next »