Regular Expressions 101

Community Patterns

youtube links in wp/embed context

1

Regular Expression
PCRE (PHP <7.3)

/
(?<=(?:\[embed\])|(?:\[embed\]\s)|(?:))(https?:\/\/)(:?www\.)?(:?youtube\.com\/watch|youtu\.be\/)([\w\?=\&]+)(?=(?:\[\/embed\])|(?:\s\[\/embed\])|(?:))
/
gims

Description

no description available

Submitted by anonymous - 10 years ago