Regular Expressions 101

Community Patterns

YouTube embeb

0

Regular Expression
PCRE (PHP <7.3)

%
(.*youtube\.com)\/(embed\/videoseries\?|watch\?|playlist\?)(.*v=([^&]+))?(&)?(.*list=([^&]+))?|(.*youtu\.be)\/([^?]+)?((\?)?(.*list=)([^?]+))?
%
i

Description

Match any format of YouTube link for YouTube embeds in any web project.

Submitted by anonymous - 4 years ago