<?php $variable = "asdfasdg <img src=\"foo.jpg\"> asdgfasdgasdg"; print preg_replace("~src=\"([^\"]+)\.(jpg|png|gif)\"~iu", "=src\"$1.$2?style=grid\"", $variable);
You have javascript disabled. You will not be able to edit any code.