lundi 4 mars 2019

replace a html tag that has a html tag inside it blockquote has inside iframe replace it with a div

so i have a html tag blockquote that has inside it a iframe i want to replace it with a div but i don't want to replace the other blackquote that has no iframe inside them heres what i tried

$news->news_body = preg_replace('/<blockquote.*class=\"twitter-tweet".*data-lang="en">.*<iframe.*src=\"(?:https?:\/\/)?(?:web\.)?facebook.com\/(.*)\".*>.*<\/iframe><\/blockquote>/isU', "<div class='facebook-iframe' src='" . $news->facebookEmbed . "'></div>", $news->news_body);

but it keep replacing every blackquote



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire