BBcode parsing problem
<p>Im building my own forum where you can use diffrent types of BBcode and one of them is [youtube][/youtube] to embed youtube videos,</p>

<p>The idea is to make it idiot-proof, the user can enter the full lenght url or just the code to the video like this </p>

<blockquote>
  <p>[youtube]http://www.youtube.com/watch?v=AJ3_kndmeCg[/youtube]<br>
  [youtube]http://www.youtube.com/watch?v=AJ3_kndmeCg&amp;feature=related[/youtube]
  [youtube]AJ3_kndmeCg[/youtube] </p>
</blockquote>

<p>Here is my code that get the code out of a full lenght url,</p>

<pre><code>&lt;?php
$getpost=$_POST['post'];  
$getpost=preg_replace("'\[youtube\].*?=(.*?)&amp;.*?\[/youtube\]'is",'yt link is \\1',$getpost);  
$getpost=preg_replace("'\[youtube\].*?=(.*?)\[/youtube\]'is",'yt link is \\1',$getpost);  
$getpost=preg_replace("'\[youtube\](.*?)\[/youtube\]'is",'yt link is \\1',$getpost);  
?&gt;
</code></pre>

<p>The results are:</p>

<blockquote>
  <p>yt link is AJ3_kndmeCg<br>
  yt link is AJ3_kndmeCg<br>
  yt link is AJ3_kndmeCg  </p>
</blockquote>

<p>It works perfectly if I only want to embed 3 youtube videos,</p>

<p>But if i wanted to embed 6 youtube videos like this:</p>

<blockquote>
  <p>[youtube]http://www.youtube.com/watch?v=AJ3_kndmeCg[/youtube]
  [youtube]http://www.youtube.com/watch?v=AJ3_kndmeCg&amp;feature=related[/youtube]   [youtube]AJ3_kndmeCg[/youtube]<br>
  [youtube]http://www.youtube.com/watch?v=AJ3_kndmeCg[/youtube]
  [youtube]http://www.youtube.com/watch?v=AJ3_kndmeCg&amp;feature=related[/youtube]
  [youtube]AJ3_kndmeCg[/youtube]</p>
</blockquote>

<p>The results are:</p>

<blockquote>
  <p>yt link is AJ3_kndmeCg<br>
  yt link is AJ3_kndmeCg[/youtube]<br>
  yt link is AJ3_kndmeCg<br>
  yt link is <a href="http://www.youtube.com/watch?v=AJ3_kndmeCg" rel="nofollow">http://www.youtube.com/watch?v=AJ3_kndmeCg</a><br>
  [youtube]AJ3_kndmeCg  </p>
</blockquote>

<p>Do you see that^^ the tags still remain on two lines and one of the lines show a full lenght URL,</p>
