Hi, I have some content that I am trying to parse...
I have html and with in the html I want to replace all my img tags with a custom string. Now one of the problems I have is that some content that comes in: the image tags is between a anchor.
ex.
<a href="link"><img></a>
The following code I have works...but I want it to be optional so in case no anchor tag is surrounded by a img tag does anyone have any good resource on regex or could help me out?
Thank you!
$content = preg_replace('#<a.*?>'.$image_tag.'</a>#i', "{$image_id}", $content);