> preg_replace("|<item>.*?$file.*?</item>|si","",$contents)
> <news>
>  <item>
>   <title>fhh</title>
>   <date>1060205191</date>
>   <text>hhh</text>
>   <file>xml/news/1060205191.xml</file>
>  </item>
>  <item>
>   <title>fgjghjh</title>
>   <date>1060205186</date>
>   <text>fgjh</text>
>   <file>xml/news/1060205186.xml</file>
>  </item>
>  <item>
>   <title>fgjhh</title>
>   <date>1060205182</date>
>   <text>fghh</text>
>   <file>xml/news/1060205182.xml</file>
>  </item>
> </news>
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)

Regards
Stefan Langer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to