Test if a string matches a given regular expression and return true or false.
This function does not generate a change.
regex.test(string)
| Argument | Type | Description |
|---|---|---|
| string | str (required) | The string to test. |
true if there is a match between the string and the regular expression, otherwise false.
Examples using test():
// The first regex is case sensitive, the second is case insensitive
[
regex("^hello").test('Hello world!!'),
regex("^hello", "i").test('Hello world!!'),
];
Return value in JSON format
[
false,
true
]