Pattern currently matches ^ and $ to newlines as well as start and end of string (multiline mode). It would be less surprising if they behaved like \A and \z (or maybe \Z).
I've seen a number of places where people use the wrong anchors. The most obvious place is in stdlib, e.g. Stdlib::Unixpath.
I've stripped out some lines to make this more legible.