Ok guys, I\'m having a hard time with regex..
Here\'s what I need... get a text file, remove all blank lines and white spaces in the beginning and end of these lines
Split, replace, filter:
quotes.split('\n') .map(function(s) { return s.replace(/^\s*|\s*$/g, ""); }) .filter(function(x) { return x; });
With input value " hello \n\nfoo \n bar\nworld \n", the output is ["hello", "foo", "bar", "world"].
" hello \n\nfoo \n bar\nworld \n"
["hello", "foo", "bar", "world"]