$test
$test
will test for a match of the pattern in the text.
Usage
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:
This will return true
since the word “hello” is in the text regardless of its casing since the flag i
is present: