Check whether a regex matches a string.
Section: JavaScript Regex APIs
test() boolean match
javascript
javascript
/error/i.test(message)Explanation
Returns `true` or `false`.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing JavaScript Regex APIs