title: Get YouTube video url or YouTube video ID from a string using RegEx
body: <p>So I've been stuck on this for about an hour or so now and I just cannot get it to work. So far I have been trying to extract the whole link from the string, but now I feel like it might be easier to just get the video ID. </p>
  
  <p>The RegEx would need to take the ID/URL from the following link styles, no matter where they are in a string:</p>
  
  <pre class="lang-none prettyprint-override"><code>http://youtube.com/watch?v=iwGFalTRHDA
  http://www.youtube.com/watch?v=iwGFalTRHDA&amp;feature=related
  https://youtube.com/iwGFalTRHDA
  http://youtu.be/n17B_uFF4cA
  youtube.com/iwGFalTRHDA
  youtube.com/n17B_uFF4cA
  http://www.youtube.com/embed/watch?feature=player_embedded&amp;v=r5nB9u4jjy4
  http://www.youtube.com/watch?v=t-ZRX8984sc
  http://youtu.be/t-ZRX8984sc
  </code></pre>
  
  <p>So far, I have this RegEx: </p>
  
  <pre><code>((http(s)?\:\/\/)?(www\.)?(youtube|youtu)((\.com|\.be)\/)(watch\?v=)?([0-z]{11}|[0-z]{4}(\-|\_)[0-z]{4}|.(\-|\_)[0-z]{9}))
  </code></pre>
  
  <p>This catches the link, however it also breaks down the link in to multiple parts and also adds that to the list too, so if a string contains a single youtube link, the output when I print the list is something like this: </p>
  
  <pre><code>('https://www.youtube.com/watch?v=Idn7ODPMhFY', 'https://', 's', 'www.', 'youtube', '.com/', '.com', 'watch?v=', 'Idn7ODPMhFY', '', '')
  </code></pre>
  
  <p>I need the list to only contain the link itself, or just the video id (which would be more preferable). I have really tried doing this myself for quite a while now but I just cannot figure it out. I was wondering if someone could sort out the regex for me and tell me where I am going wrong so that I don't run in to this issue again in the future? </p>