Regular Expressions 101

Community Patterns

Youtube video link regular expression

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^https:\/\/(youtu\.be\/[A-Za-z0-9]{11}|www\.youtube\.com\/watch\?v=[A-Za-z0-9]{11})$
/

Description

This regular expression allows you to test strings to see if they are youtube video links.

Submitted by Pythack - 3 years ago