Get video id from Vimeo url

前端 未结 5 1998
失恋的感觉
失恋的感觉 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 16:55

    The following regex will return the id on group 1 for those who only want to retrieve this information. It works with all the example URLs given in the question. It also works without http:// and https://. It also works with URLs like player.vimeo.com/...

    /^.*(?:vimeo.com)\\/(?:channels\\/|groups\\/[^\\/]*\\/videos\\/|album\\/\\d+\\/video\\/|video\\/|)(\\d+)(?:$|\\/|\\?)/
    

提交回复
热议问题