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.containsAnyOf("list")


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/Set.containsAnyOf("regexList")

The operator .containsAnyOf("regexList") is true if any of the words in a set of words (i.e. a list) is contained in the chained-to target string. As shown below, the list may have many or only one entry. The test is case-sensitive (previously it was case-insensitive). For example:

$MyBoolean = $MyList.containsAnyOf("emulate"); 

Will be true if the tested note's $Text contains the word "emulate"; unlike with .contains() or .icontains() a partial value may be matched in the target list. If $MyList holds the values 'emulate', 'mimic' and 'simulate', the list is tested as if a literal string, i.e. with the semi-colon delimiters present:

$MyBoolean = "emulate;mimic;simulate".containsAnyOf("emulate"); 

A more applied example:

$MyBoolean = $MyList.containsAnyOf(wordsRelatedTo("emulate")); 

Will be true if the tested note's $MyList contains the word "emulate".

regexList implies using a list of values (ideally with no dupes). This can be a literal list of 1 or more values—as in the example above, or an attribute reference holding a list of values, for instance:

$MyBoolean = $MyList.containsAnyOf($MySet); 

It is important to note that .containsAnyOf() is always a case-sensitive test. Thus in the first example above, it will match "emulate" but not "Emulate" or any other case variant of the word.

Although the examples above use whole words the list in regexList is actually processed assuming they are regular expressions (which may of course be literal strings). Thus in the first example above, it will match both "emulate" and "emulated" but not "emulating". The test value "emulate\b", expecting a word break after the final 'e' would this match "emulate" but not "emulated".

For a case-insensitive version if this operator see List/Set.icontainsAnyOf().

Note the slightly different behaviour from that when chaining a String.