i have this code:
<p> paragraph </p>
<p> another paragraph
<iframe frameborder="0" src="https://www.youtube.com/embed/GXIAE">
</iframe></p>
How can i take the iframe out from the paragraph into like this :
<p> paragraph </p>
<p> another paragraph </p>
<iframe frameborder="0" src="https://www.youtube.com/embed/GXIAE"></iframe>
I have tried by using regex below but doesn't work
$string = preg_replace('<p[^>]*>[^<]*\K(<iframe[^>]*><\/iframe>)(.*?<\/p>)','$2$1', $string);