my $delim = qr/^[ \t]*SOMETHING[ \t]*$/m; my $pat = qr/$delim(?:\n[ \t]*)*(?:\n|\z)/o;