JavaScript: RegExp Object

By Xah Lee. Date: . Last updated: .

RegExp is the value of the property key "RegExp" of the global object.

console.log( window["RegExp"] === RegExp ); // true

RegExp is a function.

〔►see JavaScript: Data Types

// type of RegExp
console.log ( typeof RegExp === "function" ); // true
console.log ( === "[object Function]" ) // true

The parent of RegExp is Function.prototype. 〔►see JavaScript: Prototype and Inheritance

// parent of RegExp
console.log ( Object.getPrototypeOf ( RegExp ) === Function.prototype ); // true

The purpose of RegExp is:

  1. To create instance of “RegExp” objects. RegExp is used to pattern match strings, or find string patterns, or do string replacement by pattern.
  2. Holds the property key "prototype". The value of RegExp.prototype is the parent object of all regexp instances.

〔►see JavaScript: RegExp Tutorial

RegExp Constructor

JavaScript: RegExp Constructor



JavaScript: RegExp.prototype


ECMAScript® 2016 Language Specification#sec-regexp-regular-expression-objects

RegExp Topic

  1. JavaScript: RegExp Tutorial
  2. JavaScript: String Methods for RegExp
  3. JavaScript: RegExp Object
  4. JavaScript: RegExp Constructor
  5. JavaScript: RegExp.prototype
  6. JavaScript: RegExp Syntax

String Topic

  1. JavaScript: Default Charset/Encoding
  2. JavaScript: String is 16-Bit Unit Sequence
  3. JavaScript: Unicode Character Escape Sequence
  4. JavaScript: Allowed Characters in Identifier
  5. HTML: Allowed Characters in id Attribute
  6. HTML: Character Sets and Encoding
  7. HTML XML Entities

  1. JavaScript: Template String
  2. JavaScript: Convert String to Number
  3. JavaScript Encode URL, Escape String
  4. JavaScript: Format Number
  5. JavaScript: JSON Object

  1. JavaScript: String Object
  2. JavaScript: String.prototype
  3. JavaScript: String Constructor

JS Object Reference

  1. Global
  2. Object
  3. Array
  4. Function
  5. String
  6. RegExp
  7. Date
  8. Set
  9. Map
  10. JSON
  11. Math
  12. Reflect
  13. Number
  14. Boolean
  15. Symbol
Like what you read? Buy JavaScript in Depth
or, buy a new keyboard, see Keyboard Reviews.