Skip to content

Instantly share code, notes, and snippets.

@renarsvilnis
Last active December 13, 2017 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renarsvilnis/f2cda1bb152e5a03ae79 to your computer and use it in GitHub Desktop.
Save renarsvilnis/f2cda1bb152e5a03ae79 to your computer and use it in GitHub Desktop.
Javascript function to validate if url is a valid vimeo video url.
function parseYoutubeUrl(url) {
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/,
match = url.match(regExp);
return match && match[7].length == 11 ? match[7] : false;
}
@williamli
Copy link

this checks for a Youtube Video, not Vimeo

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