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

Filter Operators

10th April 2023 at 11:41am

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

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

Table legend:

...Used to mark the most common ones
!...The column indicates whether an operator allows negation using the ! prefix.
For specifics as to each operator's negated output please refer to its documentation
C...Most steps process the selection of titles that are supplied as their input, but a few construct an entirely new selection instead, as indicated by the last column.
A C? indicates it might construct a new selection, depending on usage. For specifics as to each operator's selection creation please refer to its documentation

The following table lists all core operators:

Operator Purpose ! C
all find all titles of a fundamental category C?
backlinks find the titles that link to each input title
backtranscludes find the titles that transclude each input title
charcode generates string characters from their numeric character codes
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 find titles that yield duplicate slugs
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 parameter interpreted as a title list ! C
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 !
function apply a function to the input list, and return the result
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
jsonextract retrieve the JSON string of a property from JSON strings
jsonget retrieve the value of a property from JSON strings
jsonindexes retrieve the value of a property from JSON strings
jsonset set the value of a property in JSON objects
jsontype retrieve the type of a property from JSON strings
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 ! C
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. With a single parameter, the default field is "text" and the default index is "0". If a second parameter is provided, that becomes the target field or index.
lowercase returns each item in the list as lowercase
match returns each item in the list that matches the parameter string
minlength filter items whose length is greater than or equal to the specified minimum length
range generate a range of numbers ! C
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 parameter interpreted as a filter expression ! C?
then replace input titles by a constant string
title select a single title ! C
titlecase returns each item in the list with each word capitalised
transcludes find the titles transcluded by each input title
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 !
zth select the Zth input title
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 the titles specified in the first parameter in a cyclical manner
insertafter insert an item T into a list immediately after an item A
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 parameter from the input
replace replace marker with N trailing items
sortby sort the current list in the order of the list referenced in the parameter
toggle toggle the title specified in the parameter 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
applypatches applies a set of patches to transform the input
compare filter the input by comparing each item against the parameter !
decodebase64 apply base 64 decoding to a string
decodehtml apply HTML decoding to a string
decodeuri apply URI decoding to a string
decodeuricomponent apply URI component decoding to a string
encodebase64 apply base 64 encoding 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, see also the similar stringify
levenshtein determine the Levenshtein distance of the input title(s) and a given string
makepatches returns a set of patches that transform the input to a given 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
sha256 apply sha256 hash to a string
splitbefore select a delimited prefix from each input title
stringify apply JavaScript string encoding to a string, see also the similar jsonstringify
substitute returns each item in the list, replacing within each title placeholders for filters, parameters and variables with their corresponding values
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
acos calculate the arccosine value (in radians) of a list of numbers
add treating each input title as a number, add to each the numeric value of the parameter
asin calculate the arcsine value (in radians) of a list of numbers
atan calculate the arctangent value (in radians) of a list of numbers
atan2 returns the angle in the plane (in radians) between the positive x-axis and the ray from (0,0) to the point (x,y), for [Y]atan2[X]
average treating each input title as a number, compute their arithmetic mean
ceil rounds a list of numbers up to the next largest integer
compare filter the input by comparing each item against the parameter !
cos calculate the cosine value of a list of angles (given in radians)
divide treating each input title as a number, divide it by the numeric value of the parameter
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 parameter 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 parameter
maxall find the largest of a list of numbers
median treating each input title as a number, compute their median value
min treating each input title as a number, take the minimum of its value and the numeric value of the parameter
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 parameter
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 parameter
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 parameter
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
sin calculate the sine value of a list of angles (given in radians)
standard-deviation treating each input title as a number, compute their standard-deviation
subtract treating each input title as a number, subtract from each the numeric value of the parameter
sum produce the sum of the input numbers
tan calculate the tangent value of a list of angles (given in radians)
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
variance treating each input title as a number, compute their variance
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 C
deserialize extract JSON representation of tiddlers from the input strings
deserializers C
editiondescription select the descriptions of the input editions
editions select the names of all the TiddlyWiki editions C
getvariable select all values of variables named in the input titles
modulesproperty retrieve a module property
modules select the names of all modules of the input module types
moduletypes select the names of all TiddlyWiki module types C
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 C
subtiddlerfields select all fields present in the selected tiddlers within a plugin
variables select the names of all the actively defined variables C

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

For the exact rules, see Filter Syntax.