Support for both Unix and Windows line endings

Used regular expression /\r?\n/ to split by \r\n and \n.