3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $img = '<img src="http://ubmcmm.baidustatic.com/media/v1/0f0007MbSXctTD5AG7dqt6.jpg" style="width: 100px; height: 100px;">'; $newImg = preg_replace('/(<img\s+src=[\'|"])(.*)([\'|"].*>)/','$1aaa.jpg$3',$img); var_dump($newImg);
Output for 4.3.0 - 7.2.0
string(19) "<img src="aaa.jpg">"