Last active
December 13, 2017 08:20
-
-
Save renarsvilnis/f2cda1bb152e5a03ae79 to your computer and use it in GitHub Desktop.
Javascript function to validate if url is a valid vimeo video url.
This file contains 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 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this checks for a Youtube Video, not Vimeo