I need a preg_replace syntax to add something (anything) after the /> of an image tag that is within a string I have.
So for example
$string="here is a <img src="images/test.gif" /> string!"
needs to become…
$string="here is a <img src="images/test.gif" /><br> string!"
This will match
as well as any uppercase variations.
A breakdown of the expression:
backreference 1
<imgliterally>between 1 and unlimited times as many times as possible>literally (to account for stopping above when it was found)</img>literally between zero and 1 times (optional because of the ?)