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

search Operator

29th November 2021 at 12:07pm
purposefilter the input by searching tiddler content
inputa selection of titles
suffixthe search operator uses a rich suffix, see below for details
parameterone or more search terms, separated by spaces, or a literal search string
outputthose input tiddlers in which all of the search terms can be found in the value of field F
! outputthose input tiddlers in which not all of the search terms can be found
Learn more about how to use Filters

New in: 5.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>[<operand>]]
  • field list: a comma delimited list of field names to restrict the search
    • defaults to tags, text and title 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
  • flag list: a comma delimited list of flags (defaults to words if blank)
  • operand: filter operand

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 matches A 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: New in: 5.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: New in: 5.1.20 anchors the search to the start of the string (applies to whitespace, literal and words modes)

Examples