Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

`
<iframe\s?(?:width="(?:\d+)?")?\s?(?:height="(?:\d+)?")?\s*(.*src="https://www\.(?:youtube|vimeo)\.com.*)</iframe>
`
gm

Description

Remove width & height tage from Youtube/Vimeo embed code Useful for implementing responsive design

Submitted by Mendel Groner - 3 years ago