Q:

Perl RegExp remove img tag if content style parameter

I have a Perl RegExp question. Given this HTML code:
<a href="#"><img src="..." alt="..." title="..."></a>
<a href="#"><img src="..." alt="..." style="display: none;" title="..."></a>
<a href="#"><img src="..." alt="..." title="..." style="display: none;"></a>
<a href="#"><img src="..." style="display: none;" alt="..." title="..."></a>
<a href="#"><img style="display: none;" src="..." alt="..." title="..."></a>

How can I remove all img tags with their parent a if the img contain this string?
style="display: none;"

A:

$html =~ s|<a\s+href[^>]*>\s*<img[^>]*style="display: none;"[^>]*>\s*</a>||g

This is checking the img tag inside the a tag. And also checking whether the given style attribute resides inside the img or not.

