From 8d9f1e74778f4035095f60af2b45aa4307b772df Mon Sep 17 00:00:00 2001 From: Astrid Elocson Date: Fri, 23 Jan 2015 14:32:57 +0000 Subject: [PATCH] Catch syntax errors in regexp filters --- core/modules/filters/regexp.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/modules/filters/regexp.js b/core/modules/filters/regexp.js index d6ab27303..4f8d9a8ee 100644 --- a/core/modules/filters/regexp.js +++ b/core/modules/filters/regexp.js @@ -41,7 +41,11 @@ exports.regexp = function(source,operator,options) { regexpString = regexpString.substr(0,regexpString.length - match[0].length); } } - regexp = new RegExp(regexpString,flags); + try { + regexp = new RegExp(regexpString,flags); + } catch(e) { + return ["" + e]; + } // Process the incoming tiddlers if(operator.prefix === "!") { source(function(tiddler,title) {