This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

Filter Operators

6th February 2019 at 2:04pm
Filters

A filter operator is a predefined keyword attached to an individual step of a filter. It defines the particular action of that step.

Important: Each first step of a filter run not given any input titles receives the output of [all[tiddlers]] as its input.

The following table lists all core operators, the most common ones marked ✓. The last column indicates whether an operator allows negation using the ! prefix. For specifics as to each operator's negated output please refer to its documentation.

Operator Purpose !
all find all titles of a fundamental category
backlinks find the titles that link to each input title
contains filter the input by searching list fields for a value !
count count the number of entries in a list
days filter the input by date !
duplicateslugs returns each item in the list in a human-readable form for use in URLs or filenames
each select one of each group of input titles by field
eachday select one of each group of input titles by date
else if the list of input titles is empty then return a list consisting of a single constant string, otherwise return the original titles
enlist select titles from the operand interpreted as a title list !
field filter the input by field !
fields select all field names of the input titles
filter apply a subfilter to each input title and return the titles that return a non-empty result from the subfilter !
get select all values of a field in the input titles
getindex select all values of a data property in the input titles
has filter the input by field existence !
haschanged filter the input by tiddler modification status !
indexes select all data properties of the input titles
is filter the input by fundamental category !
join join a list of strings together with the separator S
length returns the number of characters of each item in the list
links find the titles linked to by each input title
list select titles via a list field !
listed find the titles that list the input titles
lookup applies a prefix to each input title to yield the title of a tiddler from which the final value is retrieved
lowercase returns each item in the list as lowercase
match returns each item in the list that matches the operand string
minlength filter items shorter than the specified minimum length
range generate a range of numbers !
reduce apply a subfilter to each input title in turn, accumulating a single value
regexp filter the input by pattern-matched field !
sameday filter the input by date
search filter the input by searching tiddler content !
sentencecase returns each item in the list with the first letter capitalised
slugify returns each item in the list in a human-readable form for use in URLs or filenames
split returns each item in the list split into separate strings according to the specified separator S; duplicates are not removed
splitregexp returns each item in the list split into separate strings according to the specified regular expression R
subfilter select titles from the operand interpreted as a filter expression !
then replace input titles by a constant string
title select a single title !
titlecase returns each item in the list with each word capitalised
uppercase returns each item in the list as uppercase
Order Operators
after find which input title follows a specified one
before find which input title precedes a specified one
bf same as rest
butfirst same as rest
butlast discard the last N input titles
first select the first N input titles
last select the last N input titles
limit select the first or last N input titles !
next find which titles in a list field follow the input ones
nsort sort the input by number field !
nsortcs sort the input titles by number field, treating upper and lower case as different !
nth select the Nth input title
order selectively reverse the input list
previous find which titles in a list field precede the input ones
rest discard the first N input titles
reverse reverse the order of the input titles
sort sort the input by text field !
sortan sort the input by text field considering them as alphanumerics !
sortcs sort the input by text field, treating upper and lower case as different !
sortsub sort the input by the result of evaluating a subfilter for each item !
Listops Operators
allafter discard all items except those after the marker
allbefore discard all items except those before the marker
append append a range of items from an array to the list
cycle toggle in the input, the titles specified in the first operand in a cyclical manner
insertbefore insert an item T into a list immediately before an item B
move move marker N places in the list
prepend prepend a range of items from an array to the list
putafter move N trailing items after the marker
putbefore move N trailing items before the marker
putfirst move N trailing items to the head of the list
putlast move N leading items to the tail of the list
remove remove a list of titles specified in the operand from the input
replace replace marker with N trailing items
sortby sort the current list in the order of the list referenced in the operand
toggle toggle the title specified in the operand in the input
unique remove all duplicate items from the current list
String Operators
addprefix extend each input title with a prefix
addsuffix extend each input title with a suffix
decodehtml apply HTML decoding to a string
decodeuri apply URI decoding to a string
decodeuricomponent apply URI component decoding to a string
encodehtml apply HTML encoding to a string
encodeuri apply URI encoding to a string
encodeuricomponent apply URI component encoding to a string
enlist-input select titles by interpreting each input title as a title list
escapecss apply CSS escaping to a selection of titles through the CSS.escape() method / operation
escaperegexp escape special characters used in regular expressions
format format the input string according to one of supported formats
jsonstringify apply JSON string encoding to a string
pad returns each item in the list padded to the specified length
prefix filter the input titles by how they start !
removeprefix filter the input titles by how they start, deleting that prefix
removesuffix filter the input titles by how they end, deleting that suffix
search-replace returns each item in the list, replacing within each title the string specified by the first parameter with the second parameter
splitbefore select a delimited prefix from each input title
stringify apply JavaScript string encoding to a string
suffix filter the input titles by how they end !
trim returns each item in the list with whitespace, or a given character string, trimmed from the start and/or end
Mathematics Operators
abs calculate the absolute value of a list of numbers
add treating each input title as a number, add to each the numeric value of the operand
ceil rounds a list of numbers up to the next largest integer
divide treating each input title as a number, divide them by the numeric value of the operand
exponential convert each number to exponential notation with N digits
fixed convert each number to fixed point notation with N digits after the decimal point
floor rounds a list of numbers to the largest integer less than or equal to each number
log treating each input title as a number, return its logarithm with base equal to the numeric value of the operand if specified, otherwise base e
max treating each input title as a number, take the maximum of its value and the numeric value of the operand
maxall find the largest of a list of numbers
min treating each input title as a number, take the minimum of its value and the numeric value of the operand
minall find the smallest of a list of numbers
multiply treating each input title as a number, multiply it by the numeric value of the operand
negate calculate the negation of a list of numbers
power treating each input title as a number, raise it to the power of the numeric value of the operand
precision convert each number to a string with N significant digits
product produce the product of the input numbers
remainder treating each input title as a number, return the remainder when divided by the numeric value of the operand
round rounds a list of numbers to the nearest integer
sign return -1, 0 or 1 for a list of numbers according to whether each number is negative, zero, or positive
subtract treating each input title as a number, subtract from each the numeric value of the operand
sum produce the sum of the input numbers
trunc truncates a list of numbers to their integer part, removing any fractional part
untrunc rounds a list of numbers to the next integer with largest absolute value, that is, away from zero
Tag Operators
tag filter the input by tag !
tagging find the tiddlers that have the input tags
tags select all tags of the input tiddlers
untagged discard any input titles that have tags !
Special Operators
commands select the titles of all the Node.js commands
editiondescription select the descriptions of the input editions
editions select the names of all the TiddlyWiki editions
getvariable select all values of variables named in the input titles
modules select the names of all modules of the input module types
moduletypes select the names of all TiddlyWiki module types
plugintiddlers select all shadow titles in the input plugins
shadowsource select the plugin titles that contain the input shadows
storyviews select the names of all the story views
subtiddlerfields select all fields present in the selected tiddlers within a plugin
variables select the names of all the actively defined variables

A typical step is written as [operator[parameter]], although not all of the operators need a parameter.

Most steps process the selection of titles that are supplied as their input, but a few construct an entirely new selection instead. For the exact rules, see Filter Syntax.