I have:
var post = $('.post');
post.find('.video embed').each(function(){
v = $(this);
youtubeID = v.attr('src').replace(/^.*youtube.com.*(?:\/|v=)(\w+)\//g,"");
console.log(youtubeID);
})
Here’s an example URL taken from the embed src
http://www.youtube.com/v/_eeZnLX_XBM&rel=0&egm=0&showinfo=0&fs=1
It strips the everything up to /v/ but not the ampersand and everything after that.
I want _eeZnLX_XBM only.
Try with: