The last bit (`\r?\n?`) should probably be a non-matching group so it doesn't catch \r by itself with no \n. Likely? No, but that's the pattern we want.

The very end should be `(?:\r?\n)?`