1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Thinking about your mail led me to this new push -> Mail follows

This commit is contained in:
Stephan Hradek 2014-01-13 08:44:53 +01:00
parent 9444ef095f
commit a5d75db8d2

View File

@ -51,19 +51,24 @@ function parseFilterOperation(operators,filterString,p) {
if(operator.operator === "") {
operator.operator = "title";
}
// Get the operand
var rexMatch;
// regexp?
if(!operator.indirect && filterString.charAt(p) === "/") {
// regexp
var rex = /^\/((?:[^\\\/]*|\\.))*\/([igm]*)\]/g;
var rexMatch = rex.exec(filterString.substring(p));
if(!rexMatch) {
throw "Incomplete regular expression in filter expression";
rexMatch = rex.exec(filterString.substring(p));
if(rexMatch) {
try {
operator.regexp = new RegExp(rexMatch[1], rexMatch[2]);
}
catch(e) {
// an error in the regexp -> Will do string matching
}
operator.operand = filterString.substr(p,rex.lastIndex-1);
p += rex.lastIndex;
}
operator.regexp = new RegExp(rexMatch[1], rexMatch[2]);
operator.operand = filterString.substr(p,rex.lastIndex-1);
p += rex.lastIndex;
}
else {
// Get the operand
if(!rexMatch) {
bracketPos = filterString.indexOf(operator.indirect ? "}" : "]",p);
if(bracketPos === -1) {
throw "Missing closing bracket in filter expression";