Standard built-ins
RegExp.prototype.test()
Tests for a match; g or y may change lastIndex via built-in matching.
Formal Syntax & Structure
javascript syntaxjavascript
regex.test(input)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| input | String | Input text. |
Return Value
Boolean
Whether a match succeeds.
Working Example
Example Snippetjavascript
console.log(/a/.test("cat"));