There are view tags on the page.

<amp-img layout="responsive" width="1080" height="610" src="https://tehnofan.com/uploads/posts/2017-01/1484215265_zotac_geforce_gtx_1080_mini_3.jpg" alt="Zotac GeForce GTX 1080 mini" class="fr-dib fr-draggable"> 

It is necessary after each such tag to add

 </amp-img> 

This expression does not work.

 $row['full_story'] = preg_replace( "'fr-draggable\">'si", "fr-draggable\"></amp-img>", $row['full_story'] ); 
  • Maybe this: $row['full_story'] = preg_replace( "/(\<amp\-img[^>]*\>)/", "$1", $row['full_story'] ); ? - Yuri
  • Unfortunately, it does not work, there is a complete replacement of the tag, I get </ amp-img> </ amp-img>, here is the expression $ row ['full_story'] = preg_replace ("/ (\ <amp \ -img [^ >] * \>) / "," </ amp-img> ", $ row ['full_story']); - Slaxor
  • Oh, sorry, not that. Try this: $row['full_story'] = preg_replace( "/(\<amp\-img[^>]*\>)/", "$1</amp-img>", $row['full_story'] ); - Yuri
  • Thanks, everything works, tell me, and how to remove all the form tags (and everything inside them), as well as the style elements in divs? - Slaxor
  • Using regular expressions? - Yuri

1 answer 1

Try changing your regular expression to this:

 $row['full_story'] = preg_replace( "/(\<amp\-img[^>]*\>)/", "$1</amp-img>", $row['full_story'] );