From 146bf8cbaf226ab3434076dabcadc27f5a2d1117 Mon Sep 17 00:00:00 2001 From: benbro Date: Thu, 28 Jul 2016 13:15:22 +0300 Subject: [PATCH] Include dash in the YouTube regex YouTube ID can have the following characters [a-zA-Z0-9_-] \w is missing dash --- themes/base.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/base.js b/themes/base.js index 524c34fb77..a7fa8c9903 100644 --- a/themes/base.js +++ b/themes/base.js @@ -219,8 +219,8 @@ class BaseTooltip extends Tooltip { this.quill.root.scrollTop = scrollTop; break; case 'video': - let match = value.match(/^(https?):\/\/(www\.)?youtube\.com\/watch.*v=(\w+)/) || - value.match(/^(https?):\/\/(www\.)?youtu\.be\/(\w+)/); + let match = value.match(/^(https?):\/\/(www\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/) || + value.match(/^(https?):\/\/(www\.)?youtu\.be\/([a-zA-Z0-9_-]+)/); if (match) { value = match[1] + '://www.youtube.com/embed/' + match[3] + '?showinfo=0'; } else if (match = value.match(/^(https?):\/\/(www\.)?vimeo\.com\/(\d+)/)) {