Hi
I am using a regular expression to search for a word inside a text file (rss feed) and great I can find it.
if (preg_match("/\b.".$searchWord."\b/i", $contents)) {
echo "searching ".$file." for word ".$searchWord. " Found: ".$searchWord." <br/>";
}
else...
However I would like to search for the beginning and the end of the feed item that my search word is found in <item> to </item>.
So therefore when I find the word Ebay for example, I would like to be able to find the first <item> before the word Ebay and the first </item> after the word.
Hope that makes sense
Thanks in advance
IcedEarth
Example
<item> <title>Ebay bid for Lord's title reaches £3m</title>
<link>http://www.itn.co.uk/news/ecfcb3185dc2493afd5dc0846418530b.html</link>
<description>A lord who has put his title and property up for sale on Ebay has received bids over £3 million.</description>
<guid>http://www.itn.co.uk/news/ecfcb3185dc2493afd5dc0846418530b.html</guid>
<pubDate>Fri, 08 Aug 2008 11:26:04 +0100</pubDate>
</item>