In a part of my bbcode code I made - which converts bbcode to html - I have the following for quoting:

		'/\[quote\](.*?)\[\/quote\]/is',
		'/\[quote\=(.*?)\](.*?)\[\/quote\]/is',

That is the find code. The replace is the following:

		'<blockquote><div class="msg_quote">$1</div></blockquote>',
		'<blockquote><div class="msg_quote"><span id="quote_from">Posted by $1</span><br/>$2</div></blockquote>',

This works for the first bbcode. When there is a quote inside of another quote...it fails. It just puts it out like this:

<blockquote><div class="msg_quote"><span id="quote_from">Posted by person1</span><br/>[*quote=person2]person2's text...</div></blockquote><br />

person1's text...[*/quote]<br />
<br />

person2's text

(Minus the *'s).

So from what I see it not changing the 2nd [quote] or [\quote]. So it looks like person2's quoted text is the only thing quoted.

Thanks for any help!!

    First off, I don't have a direct solution for you. This is where using a regexp solution for bbcode starts to become really messy, requiring some sort of recursive pattern/processing.

    I would suggest looking into existing implementations such as the BBCode PECL extension or the PEAR HTML_BBCodeParser package.

      I'm looking at the PEAR HTML_BBCodeParser package.

      Thanks for that.

      How do I use it exactly? I downloaded it, do I need to include the files on my pages? What do I need to include? Thanks!

        Write a Reply...