how to replace youtube url in text?
<p>I have following text</p>

<pre><code>"I made this video on my birthday. All of my friends are here in party. Click play to video the video
 http://www.youtube.com/watch?v=G3j6avmJU48&amp;feature=g-all-xit "
</code></pre>

<p>What i want is to replace this above url to</p>

<pre><code>"I made this video on my birthday. All of my friends are here in party. Click play to video the video

      &lt;iframe width="853" height="480" src="http://www.youtube.com/embed/G3j6avmJU48" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; "
</code></pre>

<p>I know we can get youtube video id from above url in following script</p>

<pre><code>     preg_match("#(?&lt;=v=)[a-zA-Z0-9-]+(?=&amp;)|(?&lt;=v\/)[^&amp;\n]+(?=\?)|(?&lt;=v=)[^&amp;\n]+|(?&lt;=youtu.be/)[^&amp;\n]+#", $word, $matches);


        $youtube_id = $matches[0];
</code></pre>

<p>But I dont know how to replace url</p>

<pre><code>http://www.youtube.com/watch?v=G3j6avmJU48&amp;feature=g-all-xit
</code></pre>

<p>to </p>

<pre><code>  &lt;iframe width="853" height="480" src="http://www.youtube.com/embed/G3j6avmJU48" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
</code></pre>

<p>Please help Thanks</p>
