angular extract youtube video link from url code example
Example: get youtube video id from url javascript
<script type="text/javascript">
function youtube_parser(url){
var regExp = /^https?\:\/\/(?:www\.youtube(?:\-nocookie)?\.com\/|m\.youtube\.com\/|youtube\.com\/)?(?:ytscreeningroom\?vi?=|youtu\.be\/|vi?\/|user\/.+\/u\/\w{1,2}\/|embed\/|watch\?(?:.*\&)?vi?=|\&vi?=|\?(?:.*\&)?vi?=)([^#\&\?\n\/<>"']*)/i;
var match = url.match(regExp);
return (match && match[1].length==11)? match[1] : false;
}
</script>