From 13bbc3ca3d91913a63ae884a4cc31dc437f29386 Mon Sep 17 00:00:00 2001 From: "Matthew W. Foster" Date: Sun, 14 Feb 2016 12:27:44 -0600 Subject: [PATCH] Updated to handle embedded or unmatched parens. --- accounting.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounting.js b/accounting.js index 755a3d5..3805125 100644 --- a/accounting.js +++ b/accounting.js @@ -197,7 +197,7 @@ var regex = new RegExp("[^0-9-" + decimal + "]", ["g"]), unformatted = parseFloat( ("" + value) - .replace(/\((.*)\)/, "-$1") // replace bracketed values with negatives + .replace(/\((.+)\)/, "-$1") // replace bracketed values with negatives .replace(regex, '') // strip out any cruft .replace(decimal, '.') // make sure decimal point is standard );