Skip to content
This repository
Browse code

Fix values with whitespace

  • Loading branch information...
commit fac20a3de66e845716232258ce219833fb1ff030 1 parent 9b79cb0
Trent Mick authored December 14, 2011
2  lib/node-iniparser.js
@@ -11,7 +11,7 @@ var fs = require('fs');
11 11
  */
12 12
 var regex = {
13 13
 	section: /^\s*\[\s*([^\]]*)\s*\]\s*$/,
14  
-	param: /^\s*([\w\.\-\_]+)\s*=\s*([^\s]*)\s*$/,
  14
+	param: /^\s*([\w\.\-\_]+)\s*=\s*(.*?)\s*$/,
15 15
 	comment: /^\s*;.*$/
16 16
 };
17 17
 
1  test/files/test.ini
@@ -6,4 +6,5 @@ a.b=c
6 6
 
7 7
 [section2]
8 8
 ;test=worth
  9
+there_is=a space in here with = and trailing tab	
9 10
 bar=foo
4  test/test.js
@@ -56,5 +56,9 @@ module.exports = {
56 56
 	'look for a commented out variable': function(){
57 57
 		var config = iniparser.parseSync('./files/test.ini');
58 58
 		assert.equal(config.section2.test, null);
  59
+	},
  60
+	'variable with space in value': function(){
  61
+		var config = iniparser.parseSync('./files/test.ini');
  62
+		assert.equal(config.section2.there_is, "a space in here with = and trailing tab");
59 63
 	}
60 64
 };

0 notes on commit fac20a3

Please sign in to comment.
Something went wrong with that request. Please try again.