$test
$test will test for a match of the pattern in the text.
Usage
$test[text;pattern;flag?]Parameters
| Field | Type | Description | Required |
|---|---|---|---|
| text | string | The text to be tested. | true |
| pattern | string | The regex pattern that will be used for the test. | true |
| flag? | string | Flags. | false |
Flags
| Flag | Name | Description |
|---|---|---|
| i | Ignore Casing | Enable case-insensitive expression search. |
| g (default) | Global | Search for all occurrences of the expression. |
| m | Multiline | Allow the wildcard character . to match newlines. |
| s | Dot All | Set boundary characters (^ and $) to match the start and end of every line. |
| u | Unicode | Interpret characters as code points, matching 32-bit characters. |
| y | Sticky | Begin searching from the lastIndex property index. |
Example(s)
This will return true since there is “Hello” in the text:
1client.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:
1client.command({2 name: "test",3 code: `$test[Hello world!;hello;gi]`4});