PHP Regex. How to remove all element anchor tags but keep anchor tags with certain href attribute contain JPG|PNG|GIF
- by namaku doni
input
<a href="http://mysite.com">My Site</a>
<a href="http://mysite.com/image.jpg"><img src="http://mysite.com/image.jpg"/></a>
<a href="http://mysite.com/image.gif"><img src="http://mysite.com/image.gif"/></a>
<a href="http://yoursite.com">Your Site</a>
output
<a href="http://mysite.com/image.jpg"><img src="http://mysite.com/image.jpg"/></a>
<a href="http://mysite.com/image.gif"><img src="http://mysite.com/image.gif"/></a>
Thank's for help