preg_match_all('@(.*)(<iframe(?:.*?)</iframe>)(.*)@gs', $html, $matches, PREG_SET_ORDER);
$matches array. Or View regex in online debugger
How can I "cut out" iframe tags in a string using regex so I can place them somewhere else on my page.
I got a page which shows an image at the top of an article, but when I add a video using my cms, I want that embedded video to be placed on the position of that image instead.
How can I look for those tags in a string and make them part of an array?
This is the article title <iframe width="853" height="480" src="https://www.youtube.com/embed/23r23ffwe" frameborder="0" allowfullscreen></iframe> This is the article text
Should be usuable like:
$array (title) $array (iframe) $array (text)
How can I select these tags? I can't find a clear answer on stackoverflow.