Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*
/

Description

Youtube GET video_id (with unit tests - feel free to add more tests)

Submitted by anonymous - 5 years ago