PHP Regex. How to remove all element anchor tags but keep anchor tags with certain href attribute contain JPG|PNG|GIF

Posted by namaku doni on Stack Overflow See other posts from Stack Overflow or by namaku doni
Published on 2013-06-29T16:18:04Z Indexed on 2013/06/29 16:21 UTC
Read the original article Hit count: 156

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about php

Related posts about regex