Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

@
^(?:(?:https?://)?(?:www\.)?youtube.com/)(?:watch\?v=|v/)([a-zA-Z0-9_]*)
@

Description

$match[0] - full url $match[1] - ID only

Submitted by Denis Efremov - 9 years ago