Do you need to use ".*?"? If there will be only white characters, use \s* instead.

skate wrote:

$contents = preg_replace( "|<item>.*?".$file.".*?</item>|si", "",
$contents );

okay, so i figured out that it's matching the first occurence of <item>
which will always be the first record and then going on to match the $file
and deleting everything between. obviously not what i want.

without giving <item> a unique attribute and without preg_match_all and
looping through them all, is there any other way to do this? make it find
the first occurence of <item> previous to $file, rather than from the start?

i hope this makes sense, and is a little clearer than i've been so far...





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



Reply via email to