becu Posted April 12, 2006 Share Posted April 12, 2006 ok, here's my problem:$string = '<abc tag="test">sumtext goes here</abc>this is not supposed to show<abc>some more text goes here</abc>';What should I do so I will only get everything inside [b]<abc[/b] and [b]</abc>[/b] tag?preg_match didn't not work because it will pull out everything including "this is not supposed to show"Thank you. Link to comment https://forums.phpfreaks.com/topic/7180-solved-how-to-search-and-pull-out/ Share on other sites More sharing options...
Barand Posted April 12, 2006 Share Posted April 12, 2006 Try[code]$string = '<abc tag="test">sumtext goes here</abc>this is not supposed to show<abc>some more text goes here</abc>';$res = array();$p3 = $p2 = 0;while (($p1 = strpos($string, '<abc', $p3)) !== false) { $p2 = strpos($string,'>',$p1); $p3 = strpos($string,'</abc>',$p2); $res[] = substr($string,$p2+1, $p3-$p2-1);}echo join ('<br />', $res);[/code] Link to comment https://forums.phpfreaks.com/topic/7180-solved-how-to-search-and-pull-out/#findComment-26369 Share on other sites More sharing options...
becu Posted April 15, 2006 Author Share Posted April 15, 2006 Hi Barand,Thank you so much for your help!I really appreciate it!Thanks again.Have a great day! I will sure ask for help again :D Link to comment https://forums.phpfreaks.com/topic/7180-solved-how-to-search-and-pull-out/#findComment-27160 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.