And a clear list of what needs to be done is a wonderful thing to have. It makes life so much easier, so thanks for putting it together!
Also, I am not sure if the match filter operator is part of the core or some some plugin that I picked up and have been carrying around in my tiddlywikis since I see no description of it in the official site.
As soon as you drag over $:/core/modules/filters/match.js ,save and refresh, those tiddlers that I gave earlier should work.
/*\
title: $:/core/modules/filters/match.js
type: application/javascript
module-type: filteroperator
Filter operator for picking parts out of fields using regular expressions
140823: reloaded for 5.0.15-beta
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.match = function(source,operator,options) {
var results = [],
fieldname = (operator.suffix || operator.operator || "title").toLowerCase();
if(operator.prefix === "!") {
if(operator.regexp) {
source(function(tiddler,title) {
if(tiddler) {
var text = tiddler.getFieldString(fieldname);
if(text !== null && !operator.regexp.exec(text)) {
results.push(title);
}
}
});
} else {
source(function(tiddler,title) {
if(tiddler) {
var text = tiddler.getFieldString(fieldname);
if(text !== null && text !== operator.operand) {
results.push(title);
}
}
});
}
} else {
if(operator.regexp) {
source(function(tiddler,title) {
if(tiddler) {
var text = tiddler.getFieldString(fieldname);
if(text !== null) {
var matches = [],
execresult = operator.regexp.exec(text);
while(execresult) {
if(execresult.length > 1) { // there were brackets
matches= matches.concat(execresult.slice(1));
}
else { // no brackets - take the full match
matches.push(execresult[0]);
}
if(operator.regexp.lastIndex === 0) { // no g-switch
break;
}
execresult = operator.regexp.exec(text);
}
if(matches) {
$tw.utils.pushTop(results,matches);
}
}
}
});
} else {
source(function(tiddler,title) {
if(tiddler) {
var text = tiddler.getFieldString(fieldname);
if(text !== null){
var incr = operator.operand.length;
if(incr === 0) { // empty operand
return;
}
var matches = [],
pos = text.indexOf(operator.operand);
while(pos >= 0) {
matches.push(operator.operand);
pos = text.indexOf(operator.operand, pos+incr);
}
if(matches) {
$tw.utils.pushTop(results,matches);
}
}
}
});
}
}
return results;
};
})();This is a bit late, but here’s my solution that returns the first line (not paragraph), using nothing but core functionality. Copy it literally (including new line as splitbefore’s parameter) into a test tiddler.
<$list filter="[{$:/ControlPanel}splitbefore[
]]" variable="firstLine"><$text text=<<firstLine>>/></$list>
—R
<$list filter="[{SomeTextyTiddler}splitbefore[. ]]" variable="firstLine"><$text text=<<firstLine>>/></$list>