JavaScript: How to Strip out everything and just get the ID?
<p>I'm creating a Bookmarklet for YouTube, i want to get the ID from the youtube link,</p>

<p>Ex: <a href="http://www.youtube.com/watch?v=YgFyi74DVjc" rel="nofollow">http://www.youtube.com/watch?v=YgFyi74DVjc</a></p>

<p>I want only "YgFyi74DVjc" from the above link, that's just an example of what i want, it has to strip out everything and just leave that end part, another thing is
i want to get the ID from this URL as well
http://www.youtube.com/verify_age?next_url=http%3A//www.youtube.com/watch%3Fv%3D[YOUTUBEID]</p>

<p>So basically when you click on some video and then on this bookmarklet it gets the youtube video ID and redirects them to a link which unlocks the video or expands the video to full size of the user's browser, i have everything coded and just need a way to get ID's from both the links, i have coded this which works for the 2nd link</p>

<pre><code>var url = "http://www.youtube.com/verify_age?next_url=http%3A//www.youtube.com/watch%3Fv%3D[YOUTUBEID]";
    var ytcode = url.substr(80,50);
    alert(ytcode);
</code></pre>

<p>Now i want someway to get ID's from both the links, please help!</p>
