<?php $text = "Hello <img src='https://example.com/image1.jpg'> , <img src='example.com/image2.jpg'> and now you :)"; $str = preg_replace('/<img[^>]*src=([\'"])(.*?)\1>/', "{#img='$2', alt=''}", $text); echo $str;
You have javascript disabled. You will not be able to edit any code.