From this question, this ...
lines = foo.value.split(/\r\n|\r|\n/);
is one way to split a string, but how do I join it back with newlines?
Also, I wonder if I is say linux which uses whichever newline character, then switch to windows, won't my web app break? The newlines become not recognized? Or maybe the browser does some conversion?