Get video id from Vimeo url

前端 未结 5 1991
失恋的感觉
失恋的感觉 2021-02-01 16:33

I\'m trying to find the best regexp to fetch vimeo video id from URL.

Example urls :

https://vimeo.com/11111111
http://vimeo.com/1111111         


        
5条回答
  •  孤街浪徒
    2021-02-01 17:03

    var r = /(videos|video|channels|\.com)\/([\d]+)/,
        a = "https://vimeo.com/album/2222222/video/11111111";
    
    console.log(a.match(r)[2]); // 11111111;
    

    http://jsbin.com/asuqic/7/edit

提交回复
热议问题