Add RegEx error handling in RuleEngine
This commit is contained in:
@@ -138,8 +138,12 @@ exports.RuleEngine = class RuleEngine {
|
||||
}
|
||||
|
||||
reTest(regex, data) {
|
||||
try {
|
||||
let match = regex.match(new RegExp('^/(.*?)/([giumy]*)$'));
|
||||
regex = new RegExp(match[1], match[2]);
|
||||
} catch (err) {
|
||||
logger.log("error","Regular Expression processing failed for RegEx " + regex + " is it in the right format?");
|
||||
}
|
||||
return regex.test(data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user