youtube-regex
youtube-regex copied to clipboard
Best YouTube Video ID regex. Online: https://regex101.com/r/rN1qR5/2 and http://regexr.com/3anm9
youtube-regex
![regexps org](http://img.shields.io/badge/regexps-approved-brightgreen.svg)
The correct Youtube video id regex. Regex done right!
Install ![Nodei.co stats](https://nodei.co/npm/youtube-regex.svg?mini=true)
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 ![MIT license](http://img.shields.io/badge/license-MIT-blue.svg)
Copyright (c) 2014 Charlike Mike Reagent, contributors.
Released under the MIT
license.