Skip to content

Commit

Permalink
replaced youtube regex with regex found on https://regexr.com/3dj5t, f…
Browse files Browse the repository at this point in the history
…ixes #4560
  • Loading branch information
janthurau committed Nov 20, 2023
1 parent 43a6a86 commit 2d7f83e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/extension-youtube/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)(?!.*\/channel\/)(?!\/@)(.+)?$/
export const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)(?!.*\/channel\/)(?!\/@)(.+)?$/g
export const YOUTUBE_REGEX = /^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/
export const YOUTUBE_REGEX_GLOBAL = /^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g

export const isValidYoutubeUrl = (url: string) => {
return url.match(YOUTUBE_REGEX)
Expand Down

0 comments on commit 2d7f83e

Please sign in to comment.