Delete everything between "quote" tags ([quote])
<p>I have nested quotes enabled in my private message system, but now I want to show the user a part of the message when they hover the title of the message.</p>

<p>To get the relevant text out of the message I want to delete the quote parts.</p>

<p>The quote structure is as follows:</p>

<pre><code>[quote]
  [quote]
    dasdasa adsadsa ds a
  [/quote]

  ddasd asd ads adsasd
[/quote]
</code></pre>

<p>How can I remove everything between de quote tags? </p>

<p>I have tried it with the following code, but the last part of the nested quotes won't remove:</p>

<pre><code>while(preg_match('#\[quote=(.*?)\](.*?)\[\/quote\]#si', $message)) {
  $message = preg_replace('#\[quote=(.*?)\](.*?)\[\/quote\]#si', '', $message, 1);
}

while(preg_match('#\[quote\](.*?)\[\/quote\]#si', $message)) {
  $message = preg_replace('#\[quote\](.*?)\[\/quote\]#si', '', $message, 1);
}
</code></pre>

<p>Any suggestions how to delete these quotes out of the message? Thx!</p>
