View Full Version : Need help with regex / bbcodes

10-31-2009, 06:24 PM

I'm creating a quote-message function. I want to quote a message, and if another person quotes me, it adds all those extra quotes all-in-one.

Quoting one message works - however, when there's more, the bbcode doesn't work.


User 1 said:

User 2 said:
Bla bla

But when it's displayed, it only turns one pair of
into a plain grey box with text, and the others remain as text "[ quote]" and "[/ quote]".

I hope that made any sense.

My BBcode script is as follows:

function bbcode($text){
$find = array(

$replace = array(
"<div style=\"border: 1px solid #000000; background: #F2F2F2;\"><div style=\"padding: 3px;\">\\1</div></div>"

$text = preg_replace($find,$replace,$text);
return $text;

Also to mention, I'm not that great/familiar with regex yet.

Phil Jackson
10-31-2009, 06:42 PM

note: This will retrieve the first parent and all children quotes.

10-31-2009, 07:20 PM

Nothing happened. I also edited your last [ quote] to [ /quote]. But same result as before.

11-01-2009, 11:45 AM
Can anyone help? :confused: I still haven't figured it out.