Skip to content

$test

$test will test for a match of the pattern in the text.

Usage

$test[text;pattern;flag?]

Parameters

FieldTypeDescriptionRequired
textstringThe text to be tested.true
patternstringThe regex pattern that will be used for the test.true
flag?stringFlags.false

Flags

FlagNameDescription
iIgnore CasingEnable case-insensitive expression search.
g (default)GlobalSearch for all occurrences of the expression.
mMultilineAllow the wildcard character . to match newlines.
sDot AllSet boundary characters (^ and $) to match the start and end of every line.
uUnicodeInterpret characters as code points, matching 32-bit characters.
yStickyBegin searching from the lastIndex property index.

Example(s)

This will return true since there is “Hello” in the text:

1
client.command({
2
name: "test",
3
code: `$test[Hello world!;Hello;g]`
4
});

This will return true since the word “hello” is in the text regardless of its casing since the flag i is present:

1
client.command({
2
name: "test",
3
code: `$test[Hello world!;hello;gi]`
4
});