http://www.perlmonks.org?node_id=1000258


in reply to Re^2: Regex assistance, please.
in thread Regex assistance, please.

Yes, that's because the (?!\s*###+) only needs to match once, at the end of a line. You need to modify the regex to have match at start of every line.