RegexYoutubeJavascript

From XPUB & Lens-Based wiki
Revision as of 16:35, 7 February 2012 by Jonas Lund (talk | contribs) (Created page with "<source lang="javascript"> function youtube_parser(url){ var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\??v?=?))([^#\&\?]*).*/; var match = url.match(r...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
function youtube_parser(url){
    var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\??v?=?))([^#\&\?]*).*/;
    var match = url.match(regExp);
    if (match&&match[7].length==11){
        return match[7];
    } else {
        return("QRY");
    }
}