.*?<\/blockquote>)/&repl($1,$2,$3,$4,$5);/eisg; $content =~ s/(\[\s*[0-9]*<\/a>.*?)(
\s*\[\s*)(|.*?<\/blockquote>)/&repl($1,$2,$3,$4,$5);/eisg; print $content; sub repl($$$$$) { my ($pre1, $name, $pre2, $lnk, $abstract) = @_; # remove numbering if($remove_numbers ) { $pre1 =~ s/\[.*\]/ /s; } if ($abstract =~ /(.*?)<\/blockquote>/is) { my $abtxt = $1; my $absdoc = $name."-abstract.html"; unless(open OUT,">$path$absdoc"){die("couldn't write to $path");} print OUT 'Abstract '.$stylesheet.'Abstract
'.$abtxt.'
'; print OUT ''; close OUT; return $pre1.$pre2."abstract | ".$lnk; } else { return $pre1.$pre2.$lnk.$abstract; # no abstract found } }