View Full Version : regex for bbcode

10-04-2004, 08:03 AM

I have the following regex that I wish to modify.

'/(?<!\\\\)\[quote(?::\w+)?\](.*?)\[\/quote(?::\w+)?\]/si' => "<div class=\"quote\">\\1</div>",
'/(?<!\\\\)\[quote(?::\w+)?=(?:&quot;|"|\')?(.*?)["\']?(?:&quot;|"|\')?\](.*?)\[\/quote\]/si' => "<div>Quote \\1:<div class=\"quote\">\\2</div></div>",

this will give me something like:

<div class="quote">something quoted here</div>

I have problems when someone enter (quote)(quote) something (/quote)(/quote). I'm trying to modify the regex so that it'll be convert all (/quote) to </div> and (quote) to <div class="quote">

I also want to convert (quote from username) something (/quote) to <div class="quotehead>username</div><div class="quote">something </div>

Note: I replaced the square brackets to round brackets incase it got converted by this board.

Thank you.

10-04-2004, 08:53 AM
never mind. I searched the forums and found a solution which I modified to work. Sorry for the trouble.