Skip to content

regexhq/youtube-regex

Repository files navigation

youtube-regex NPM version Build Status Coveralls regexps org

The correct Youtube video id regex. Regex done right!

Install Nodei.co stats

Install with npm

$ npm install youtube-regex
$ npm test

Online

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

Charlike Mike Reagent author tips

License MIT license

Copyright (c) 2014 Charlike Mike Reagent, contributors.
Released under the MIT license.