I am using following function to parse YouTube URL to retrieve a YouTube ID from a YouTube URL:
function yt_parser()
{
var yt_url_sub = http://www.youtube.com/watch?v=6nZlXB5okeo;
var youtube_id = yt_url_sub.replace(/^[^v]+v.(.{11}).*/,"$1");
alert(youtube_id);
}
output : 6nZlXB5okeo
but how should I validate whether this URL is from YouTube or not?