Regex Remove Images with style tag from Html
- by Mark Milford
Hi
I am new to Regex, however I decided it was the easiest route to what I needed to do. Basically I have a string (in PHP) which contains a whole load of HTML code... I want to remove any tags which have style=display:none...
so for example
<img src="" style="display:none" />
<img src="" style="width:11px;display: none" >
etc...
So far my Regex is:
<img.*style=.*display.*:.*none;.* >
But that seems to leave bits of html behind and also take the next element away when used in php with preg_replace.