title: Parse URL for video ID
body: <p>I used to embed YouTube video's via a link I have in a database. </p>
  
  <p>YouTube no longer allows me to embed in this fashion. Instead, I need to extract the video ID from the URL I have stored. </p>
  
  <p>Here is an example of the link: </p>
  
  <pre><code>http://www.youtube.com/watch?v=72xSxQIRelc&amp;amp;feature=youtube_gdata
  </code></pre>
  
  <p>The ID I need to extract is <code>72xSxQIRelc</code>. I know I could do something like: </p>
  
  <pre><code>string vidID = 
      preURL.Substring(preURL.LastIndexOf("v=") + 2,
      preURL.Substring(preURL.LastIndexOf("v=") + 2).Length -
      preURL.Substring(preURL.LastIndexOf("&amp;feature")).Length)
  </code></pre>
  
  <p>I've seen some Regex stuff on here that does this. I'm wondering if my way is horribly inefficient, comparatively. I'm also not a regex kung fu wizard, so I'm not sure if the solutions I'm seeing are scalable if YouTube changes the URL structure (in this case, it's hard coded to require v= as well as &amp;feature).</p>
  
  <p>My solution still seems pretty hackish to me. Is there a more efficient way of doing this?</p>
  
  <hr>
  
  <p><strong>Added</strong></p>
  
  <p>This app is wrapped in a <strong>silverlight</strong> solution, so I should mention that here. </p>
  
  <p>One posted solution was to use HttpUtility.ParseQueryString. That looked like it was the answer, up until I discovered that Silverlight's implementation of HttpUtility doesn't include the ParseQueryString method. </p>