Regular Expressions 101

Community Patterns

There does not seem to be anything here

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
https?:\/\/(youtu\.be|(www\.|m\.|music\.)?youtube(-nocookie)?\.com)(\/(.*)(([?&]v=)([a-zA-Z0-9_-]{11}))|((\/attribution|\/oembed).*(v%3D)([a-zA-Z0-9_-]{11}))|((\/shorts\/)([a-zA-Z0-9_-]{11}))|((\/embed\/)([a-zA-Z0-9_-]{11}))|((\/v\/)([a-zA-Z0-9_-]{11}))|((\/user)(\/.+1\/)([a-zA-Z0-9_-]{11}))|((\/e\/)([a-zA-Z0-9_-]{11}))|((\/live\/)([a-zA-Z0-9_-]{11}))|((\/watch\/)([a-zA-Z0-9_-]{11}))|((\/)([a-zA-Z0-9_-]{11})))
/
gi

Description

Youtube match all URL / ID

Note: Not work with rust lang if u want to use it in rust remove all the ' \ '.

Regex link to watch update in the future and get data URL: https://regex101.com/r/lH4He5/

Submitted by ccauvang - a month ago (Last modified 10 days ago)