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] Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
vbnullchar Posted November 24, 2006 Author Share Posted November 24, 2006 thanks... 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.