This version is out of date, covering development from v9.0.0 to v9.3.0. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v9 Icon

List/Set.icontains("regex")


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Item   [operators of similar scope]

 Query Boolean   [other Query Boolean operators]

 Baseline

 


List.icontains("regex")

This operator tests whether regex matches the referenced string attribute or matches a whole discrete value string within a the referenced list/set attribute value. Matches are always case-insensitive, unlike String/List.contains(). The match gives a Boolean result.

regex is one of:

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

$MyList.icontains("regex")

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:

$MyList.icontains("Tuesday") 

$MyList(parent).icontains("Tuesday") 

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

$MyList.icontains($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:

"Saturday;Sunday".icontains("Sunday") 

"Saturday;Sunday".icontains($MyDay) 

If the regex is found the function returns the matched list position (1-based). Formerly, .contains() returned true if the regex was found.

Testing "does not contain"

Use a ! prefix to the query argument:

!$MyList.icontains("Tuesday") 

Use of parentheses after the !, around the query, can assist Tinderbox's parsing:

!($MyList.icontains("Tuesday"))