One place it breaks is the first place I tried to use it a few years ago, when someone (sorry; don’t remember who) originally posted it: across block comments. I was trying to write a quick search and replace to move function heads below the comment blocks in .s and .sh files, as I don’t like the existing style, but would only make the change if I could quickly automate it.
I believe the basic problem is that at some point the pattern becomes too complex for the Classic or UNIX engines. The problem nearly always involved the repeated $ anchors, and was likely due to some internal limit overflow, although I never checked in the code (mostly assembler, and while I like assembler, I’m not a masochist ).
Of course, with the new Perl engine’s multi-line matching, you needn’t bother with messy expressions like this one; you can put the messiness elsewhere.