But the preceding clause says it handles \r\n. If you're already handling \r\n, what remaining sources of \r are there, that you'd actually want to silently ignore?
Someone else (possibly you) already split on \n.
Fair point. I think if something is getting mangled like that I'd rather fail loudly, but it depends on the use case I suppose.
\r\n?|\n
handles all EOL sequences without backtracking. Or write a non-regex equivalent of that.
I'm sure every time you split something on newlines you remember to use a regex.
I tend not to, because it's an overkill, but this regex nicely sums what needs to be done.