Remix.run Logo
HackerThemAll 21 hours ago

\r\n?|\n

handles all EOL sequences without backtracking. Or write a non-regex equivalent of that.

inigyou 20 hours ago | parent [-]

I'm sure every time you split something on newlines you remember to use a regex.

HackerThemAll 18 hours ago | parent [-]

I tend not to, because it's an overkill, but this regex nicely sums what needs to be done.