Oh my, found another regex bug. This time in Java. It's still present in the latest version, Java SE 16 (2021-03-16).
Do you make me up? -
Try it online! - it should work with the
^
anchor removed, and it does in Perl and .NET, but not in Java. Quite bizarre. Same happens if I use a comma delimiter instead of newline.