I need to remove all images in a variable using the following pattern. (With PHP).
<div class="float-right image">
<img class="right" src="http://www.domain.com/media/images/image001.png" alt="">
</div>
All the div tags will have an image class, but the float-right might vary. I can’t seem to get the regex working, please help me.
This regex matches your pattern:
I have tested it against several strings. It will work on:
, where you can replace the “blah” and “anything” strings with anything.
Also, the various \W* in the regex allow for different spacing from string to string.
You said you want to do this in PHP.
This will zap all the matched patterns from a page stored in the $my_html variable.
I think this is what you were looking for?