Skip to content

Instantly share code, notes, and snippets.

@renarsvilnis
Last active May 30, 2022 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save renarsvilnis/8779a533d283136f94e6 to your computer and use it in GitHub Desktop.
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.
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;
}
@matiastucci
Copy link

Javascript function to validate if url is a valid youtube video url.

Should say vimeo

@renarsvilnis
Copy link
Author

@matiastucci Thanks, updated it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment