youtube-regex
v1.0.5
Published
The correct Youtube video id regex! Regex done right!
Downloads
7,550
Readme
youtube-regex
The correct Youtube video id regex. Regex done right!
Install
Install with npm
$ npm install youtube-regex
$ npm test
Online
- http://regexr.com/3a2p0
- https://regex101.com/r/rN1qR5/2
Usage
var youtubeRegex = require('youtube-regex');
// contains youtube url address
youtubeRegex().test('unicorn youtube.com/watch?v=0EWbonj7f18');
//=> true
// also these will works
youtubeRegex().test('youtube.com/watch?v=0EWbonj7f18');
//=> true
youtubeRegex().test('youtube.com/watch?feature=related&v=0EWbonj7f18');
//=> true
youtubeRegex().test('youtube.com/watch?v=0EWbonj7f18&feature=related');
//=> true
youtubeRegex().test('http://www.youtube.com/watch?v=0EWbonj7f18');
//=> true
youtubeRegex().test('http://www.youtube.com/watch?feature=related&v=0EWbonj7f18');
//=> true
For more use-cases see tests
Authors & Contributors
License
Copyright (c) 2014 Charlike Mike Reagent, contributors.
Released under the MIT
license.