my $match = 0; my $post_body = ...from db...; $match++ while $post_body =~ s/(.*?)<\/c>/Download Me<\/a>
$1<\/pre>/i;