vbnullchar Posted November 23, 2006 Share Posted November 23, 2006 hello everyone, how can i parse nested quote tags[code][quotes id=2][quotes id=1]one[/quotes] two [/quotes][/code] Link to comment https://forums.phpfreaks.com/topic/28216-parsing-bbcode-quote-tag/ Share on other sites More sharing options...
Nicklas Posted November 23, 2006 Share Posted November 23, 2006 With a callback funktionex[CODE]<?phpfunction quote_it($str, $id) { if(preg_match('~\[quotes~i', $str)) { $str = "<div style=\"border: 1px solid #000\" id=\"$id\">\n"; } else { $str = "\n</div>\n"; }return $str;}$string = '[quotes id=2][quotes id=1]one[/quotes] two [/quotes]';echo preg_replace('~(\s*\[quotes\s+id=(\d+)]\s*)|(\s*\[/quotes]\s*)~ise', 'quote_it("\\1", "\\2")', $string);?>[/CODE] Link to comment https://forums.phpfreaks.com/topic/28216-parsing-bbcode-quote-tag/#findComment-129169 Share on other sites More sharing options...
vbnullchar Posted November 24, 2006 Author Share Posted November 24, 2006 thanks... Link to comment https://forums.phpfreaks.com/topic/28216-parsing-bbcode-quote-tag/#findComment-129538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.