2 ms·
\r\n?|\n handles all EOL sequences without backtracking. Or write a non-regex equivalent of that.
by HackerThemAll 2mo ago
\r\n?|\n
handles all EOL sequences without backtracking. Or write a non-regex equivalent of that.
- inigyou 2mo agoI'm sure every time you split something on newlines you remember to use a regex.
- HackerThemAll 2mo agoI tend not to, because it's an overkill, but this regex nicely sums what needs to be done.