Operator Scope of Action:
Operator First Added:
Operator Last Altered:
Operator Uses Regular Expressions:
The operator .icontainsAnyOf("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 only one entry. The test is case-insensitive. For example:
$MyBoolean = $Text.icontainsAnyOf("emulate");
Will be true if the tested note's $Text contains the word "emulate". A more applied example:
$MyBoolean = $Text.icontainsAnyOf(wordsRelatedTo("emulate"));
Will be true if the tested note's $Text contains the word "aspire".
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 = $Text.icontainsAnyOf($MySet);
It is important to note that .containsAnyOf() is always a case-insensitive test. Thus in the first example above, it will match both "emulate" and "Emulate" or any other case variant of the word.
Use of regular expressions
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-sensitive version of this operator see String.containsAnyOf().
Note that behaviour of the operator is slightly different if chained to a List or Set.