From 16af6b07d14c5f66781d6b0c548ea78d88c4b9ee Mon Sep 17 00:00:00 2001 From: Kevin Kirsche Date: Mon, 2 Mar 2015 18:26:55 -0500 Subject: [PATCH] [Fix #133] StringReader fails to normalize Windows line endings [Fix #133] StringReader fails to normalize Windows line endings `\r` matches a carriage return `\n` matches a newline character. `{1, 2}` matches between either 1 or 2 of the preceding tokens This way you can start with either and should cover both linux or windows to fix #133 --- src/util/StringReader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/StringReader.js b/src/util/StringReader.js index fd589399..84c66324 100755 --- a/src/util/StringReader.js +++ b/src/util/StringReader.js @@ -13,7 +13,7 @@ function StringReader(text){ * @type String * @private */ - this._input = text.replace(/\n\r?/g, "\n"); + this._input = text.replace(/(\r|\n){1,2}/g, "\n"); /** @@ -264,4 +264,4 @@ StringReader.prototype = { return buffer; } -}; \ No newline at end of file +};