Tinderbox v9 Icon


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

Operator Uses Regular Expressions: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Query Boolean  [other Query Boolean operators]


 As at baseline

 [More on regular expressions in Tinderbox]


This operator tests whether the string matchStr matches a whole discrete value string within a the referenced list/set attribute value. Unlike when used with a String, e.g. String.contains, there is no regex functionality. With lists the function behaves as if the chained list were being iterated and an equality (==) test was being run on each list item.

Matches are always case-insensitive, unlike List/Set.contains() where the matches are always case-sensitive.

Used with a list (List or Set data types), .icontains() cannot match to granularity less than a single whole item in the chained list. Importantly, this differs from the operator's use with String data, e.g. String.icontains(), where regular expression matching is applied. If regex parsing is needed, e.g. to match a partial list value, coerce the list to a string and use to operator on that string—see below.

A match gives a numerical result which is the 1-based matched list position. That number coerces to the boolean result needed for use in queries: ) to false and 1 or more to true.

matchStr is one of:

N.B. Unlike with String-type attributes, regex cannot be used.


The contains operator may also be used with both sets and lists, in which case it tests for set membership, i.e. matching to complete individual values rather than part of values. Thus:



are both true if $MyList contains "Monday;Tuesday;Friday". A match can use an attribute value as the regexStr. Consider a single-value String-type attribute 'MyDay':


is true if the value of $MyDay for a given note is any of "Monday", "Tuesday or "Friday". Thus in an agent or find query, the regex varies by the source value in the currently-tested note.

The chained list may also be a literal list:



If the matchStr is found the function returns a number which is the 1-based matched list position. In the last example above the returned value will be 2, because 'Sunday' is the second item in the list.

Testing a negative: "does not contain"

Use a ! prefix to the query argument:


Use of parentheses around the negated query term, can assist Tinderbox's parsing:


Matching partial list values

As changing to list suppresses the normal string regex parsing, interposing the .asString() operator allows the list to be treats a a string so as to behave like a String.icontains() test. See the .asString() operator listing for more detail. This is a more elegant replacement for the old workaround of using List.format("#").icontains("some match) as may be seen in some older code samples.