11th July 2023 at 8:43am
purpose | filter the input by searching tiddler content |
---|---|
input | a selection of titles |
suffix | the search operator uses a rich suffix, see below for details |
parameter | one or more search terms, separated by spaces, or a literal search string |
output | those input tiddlers in which all of the search terms can be found in the value of field F |
! output | those input tiddlers in which not all of the search terms can be found |
Learn more about how to use Filters
Introduced in v5.1.18 The search filter operator was significantly enhanced in 5.1.18. Earlier versions do not support the extended syntax and therefore do not permit searching multiple fields, or the literal or casesensitive options.
The search
operator uses an extended syntax that permits multiple fields and flags to be passed:
[search:<field list>:<flag list>[<parameter>]]
- field list: a comma delimited list of field names to restrict the search
- defaults to
tags
,text
andtitle
if blank - an asterisk
*
instead of the field list causes the search to be performed across all fields available on each tiddler - preceding the list with a minus sign
-
reverses the order so that the search is performed on all fields except the listed fields
- defaults to
- flag list: a comma delimited list of flags (defaults to
words
if blank) - parameter: filter parameter
This example searches the fields title
and caption
for a case-sensitive match for the literal string :
[search:title,caption:literal,casesensitive[The first]]
The available flags are:
- Search mode - the first to be set of the following flags determines the type of search that is performed:
- literal: considers the search string to be a literal string, and requires an exact match
- whitespace: considers the search string to be a literal string, but will consider all runs of whitespace to be equivalent to a single space. Thus
A B
matchesA B
- regexp: treats the search string as a regular expression. Note that the regexp option obviates the need for the older
regexp
operator. - words: (the default) treats the search string as a list of tokens separated by whitespace, and matches if all of the tokens appear in the string (regardless of ordering and whether there is other text in between)
- some: Introduced in v5.2.2 treats the search string as a list of tokens separated by whitespace, and matches if at least one of the tokens appear in the string
- casesensitive: if present, this flag forces a case-sensitive match, where upper and lower case letters are considered different. By default, upper and lower case letters are considered identical for matching purposes.
- anchored: Introduced in v5.1.20 anchors the search to the start of the string (applies to whitespace, literal and words modes)