Last active
May 30, 2022 13:56
-
-
Save renarsvilnis/8779a533d283136f94e6 to your computer and use it in GitHub Desktop.
Javascript helper function to validate if url is a valid Vimeo video url.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseVimeoUrl(url) { | |
const regExp = /(?:https?:\/\/(?:www\.)?)?vimeo.com\/(?:channels\/|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/; | |
const match = url.match(regExp); | |
return match ? match[3] : false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@matiastucci Thanks, updated it!