Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/|.*\&v\=|.*\/embed\/)([\w\-]+)
/
gm

Description

To get video id from different formats

Submitted by bux - 9 years ago