Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?:https?:\/\/\w*\.?)?(youtube\.com\/|youtu\.be?\/)+(watch\?v=|shorts\/)?+(\w+)
/
gm

Description

Regex for youtube pattern

Submitted by Suraj Shah - 3 years ago