1
2
function youtubeVideoId(url){
var matches1 = url.match(/v=([\w-_]+)/), // Matches the v= part of the youtube url
Given a URL such as: ' http://www.youtube.com/watch?v=l40pzaWhC2M' or ' http://youtu.be/l40pzaWhC2M'
This function will return just the ID of the video, in this case 'l40pzaWhC2M'
This function will return just the ID of the video, in this case 'l40pzaWhC2M'
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.