in reply to Remove section from a HTML file
you probably need to explain this case in a little more detail, but i see no reason why this example is too complicated to solve with a simple regex.
i would break this problem up into two parts where the first portion consists of working with only the files with one dot:
my @files = grep { s/\././g < 2 } <*.html>;then you can focus on modifying the files that qualify. if i understand your example correctly (and i probably don't) here's how i would remove the first div only if the second div contains an img tag with its src set to indent.gif
$html =~ m|<div class="sectionHeading">.+?</div>\s+<div class="section +Content">.+?<img .+? src="./../../images/indent.gif">.+?</div>|s and +do { $html =~ s|<div class="sectionHeading">.+?</div>\s+||; };
actually, this can probably be done using a look ahead but then the example gets a little more complicated.
|
|---|