From 7a657891ea1cd94407ddb928c978c51873fe6c95 Mon Sep 17 00:00:00 2001 From: MrOrz Date: Tue, 12 Jun 2012 15:29:59 +0800 Subject: [PATCH] Trivial fix on regex escape --- lib/backends/localStorage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/backends/localStorage.js b/lib/backends/localStorage.js index 949cd00..0410643 100644 --- a/lib/backends/localStorage.js +++ b/lib/backends/localStorage.js @@ -1,7 +1,7 @@ var _ = require("underscore")._; var LocalStorageBackend = function(options) { - var options = options || {}; + options = options || {}; var name = options.name || Math.floor(Math.random() * 100000); this.prefix = 'classifier.bayesian.' + name; @@ -61,7 +61,7 @@ LocalStorageBackend.prototype = { toJSON : function() { var words = {}; - var regex = new RegExp("^" + this.prefix + "\.words\.(.+)$") + var regex = new RegExp("^" + this.prefix + "\\.words\\.(.+)$") for (var item in this.storage) { var match = regex.exec(item); if (match) {