I'm working on some BBcode for my website. 

I've managed to get most of the codes working perfectly, however the [QUOTE] tag is giving me some grief. 

When I get something like this:

```
[QUOTE=1]
[QUOTE=2]
This is a quote from someone else
[/QUOTE]
This is someone else quoting someone else
[/QUOTE]

```

It will return:

```
> 1 said:  [QUOTE=2]This is a quote from
> someone else

This is someone else quoting someone else[/QUOTE]

```

So what is happening is the [/quote] from the nested quote is closing the quote block.

The Regex I am using is:

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

```

How can I make it so nested Quotes will appear properly?

Thank you.