Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

YouTube IDs with dashes #5

Closed
medizinundmedien opened this issue May 27, 2018 · 1 comment
Closed

YouTube IDs with dashes #5

medizinundmedien opened this issue May 27, 2018 · 1 comment
Labels

Comments

@medizinundmedien
Copy link

The \w metacharacter at

if (!/^\w+$/.test(id)) throw BadRequest
won't match all YouTube video IDs. YouTube video IDs can contain dashes (-) and underscores (_) – examples below:

https://www.youtube.com/watch?v=ZW9O45G-J1c
https://www.youtube.com/watch?v=RtU_mdL2vBM
https://www.youtube.com/watch?v=TK0-Qi0_SHg

A "better" pattern would check those characters with a length of 11 characters: /^[-_a-zA-Z0-9]{11}$/ instead of /^\w+$/

@compeak compeak added the bug label May 28, 2018
@compeak
Copy link
Collaborator

compeak commented May 28, 2018

Thank you for reporting this bug. It has been fixed in 4aa8378 and v1.0.0.

\w contains _.

@compeak compeak closed this as completed May 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant