title: Finding string between custom tags and doing something with it
body: <p>On my new project, members are able to use my YouTube API and it will generate a tag like below for them to use it in whatever textarea they want:</p>
  
  <pre><code>&lt;ymedia&gt;http://www.youtube-nocookie.com/v/qQG0XfU-bFs&lt;/ymedia&gt;
  </code></pre>
  
  <p>I want my PHP profile page to take the string between <code>&lt;ymedia&gt;&lt;/ymedia&gt;</code> and generate a similar code below using <code>$ymstring</code> for the string collected from the ymedia tag:</p>
  
  <pre><code>&lt;?php
  $u_agent = $_SERVER[''HTTP_USER_AGENT''];
  if(preg_match(''/Opera/i'',$u_agent)){
  &lt;object width="320" height="240" data="".$ymstring."?fs=1&amp;amp;hl=en_US&amp;amp;rel=0"&gt;&lt;param name="movie" value="".$ymstring."?fs=1&amp;amp;hl=en_US&amp;amp;rel=0" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="wmode" value="transparent" /&gt;&lt;param name="bgColor" value="#ffffff" /&gt;&lt;param name="flashvars" value="vu=".$ymstring."?fs=1&amp;amp;hl=en_US&amp;amp;rel=0" /&gt;&lt;/object&gt;
  } else {
  &lt;object width="320" height="240"&gt;&lt;param name="movie" value="".$ymstring."?fs=1&amp;amp;hl=en_US&amp;amp;rel=0"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="".$ymstring."?fs=1&amp;amp;hl=en_US&amp;amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="240"&gt;&lt;/embed&gt;&lt;/object&gt;
  }
  ?&gt;
  </code></pre>
  
  <p>Basically, I'm trying to find all the ymedia tags in a $string and replace them with my youtube coding above aimed at either Opera or the rest of other browsers.</p>