Created
August 6, 2010 14:24
-
-
Save dafi/511384 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove empty lines and multiple carriage return/newline | |
var lines = "1\r\n\n\n\n2\n3\n\n \n\n" | |
.replace(/^\s*$/mg, '') // remove empty lines | |
.replace(/[\r\n]+/g, '\n') // all carriage return/newline | |
.replace(/\n$/, '') // remove newline at end | |
.split('\n'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment