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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 ??? Quote Link to comment 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); ?> Quote Link to comment Share on other sites More sharing options...
Lodius2000 Posted August 1, 2008 Author Share Posted August 1, 2008 thankyou! solved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.