JS: RegExp.prototype.test

By Xah Lee. Date: . Last updated: .


Return true if regex match part or whole of string, else false.

// example of RegExp “test” method
// check if a string match

const gx = RegExp ("4");

console.log ( gx.test ("345")); // true
console.log ( gx.test ("999")); // false


ECMAScript® 2016 Language Specification#sec-regexp.prototype.test

RegExp Topic

  1. JS: RegExp Tutorial
  2. JS: RegExp Syntax
  3. JS: Regex Find/Replace
  4. JS: RegExp Object
  5. JS: RegExp Constructor
  6. JS: RegExp.prototype
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.