Re: greedy preg
| From: | skate | Date: | Wed, 06 Aug 2003 22:26:50 +0000 |
| Subject: | Re: greedy preg | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-158576@lists.php.net to get a copy of this message | ||
> 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?