Lodius2000 Posted July 31, 2008 Share Posted July 31, 2008 i am trying to explode a string that has the text i want between b tags, there is other text on the page that i dont want, so i cant use strip tags and then explode to a " "(space) but ALL the text that i want is inbetween those bold tags. but the b tags are not the tags on the page, it is a list on the page that a sample line would read <a name=></a><hr><a name="food"></a><abbr title="pancake"><b>pancake</b></abbr> - flapjack and then the pattern repeats, but <a name="food">, the word food could be a myriad of things, as could the abbr title="", so how do i just grab, what is between the b tags there are hundreds of items in this list, and I did not write it, but i need those words thanks Link to comment https://forums.phpfreaks.com/topic/117461-solved-help-with-explode/ Share on other sites More sharing options...
tibberous Posted July 31, 2008 Share Posted July 31, 2008 I'm just use preg_match_all, you'll go nuts trying to do it with explode. Link to comment https://forums.phpfreaks.com/topic/117461-solved-help-with-explode/#findComment-604217 Share on other sites More sharing options...
Lodius2000 Posted July 31, 2008 Author Share Posted July 31, 2008 man i suck so bad at regex Link to comment https://forums.phpfreaks.com/topic/117461-solved-help-with-explode/#findComment-604218 Share on other sites More sharing options...
Lodius2000 Posted July 31, 2008 Author Share Posted July 31, 2008 so heres what i have so far, but i doesnt work preg_match_all("@<b>.+?</b>@U", $str, $badwords); i also tried preg_match_all("@<b>?</b>@", $str, $badwords); help ??? Link to comment https://forums.phpfreaks.com/topic/117461-solved-help-with-explode/#findComment-604228 Share on other sites More sharing options...
samshel Posted July 31, 2008 Share Posted July 31, 2008 <?php $str = '<a name=></a><hr><a name="food"></a><abbr title="pancake"><b>pancake</b></abbr> - flapjack <a name=></a><hr><a name="food"></a><abbr title="pancake"><b>pancake2</b></abbr> - flapjack'; preg_match_all("@<b>([^<]*)<\/b>@", $str, $arrMatches); var_dump($arrMatches); ?> Link to comment https://forums.phpfreaks.com/topic/117461-solved-help-with-explode/#findComment-604300 Share on other sites More sharing options...
Lodius2000 Posted August 1, 2008 Author Share Posted August 1, 2008 thankyou! solved Link to comment https://forums.phpfreaks.com/topic/117461-solved-help-with-explode/#findComment-605171 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.