This is the ThingsDB documentation for version v0, click here for the latest version!
Test if a string matches a given regular expression and return true or false.
This function does not generate an event.
str.test(regex)
| Argument | Type | Description |
|---|---|---|
| regex | regex (required) | The regular expression to test against the string. |
true if there is a match between the string and the specified regular expression, otherwise false.
Examples using test():
[
'Hello world!!'.test(/^hello/),
'Hello world!!'.test(/^hello/i),
];
Return value in JSON format
[
false,
true
]