JS: 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 JS: Data Types

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

The parent of RegExp is Function.prototype. 〔►see JS: 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 JS: RegExp Tutorial

RegExp Constructor

JS: RegExp Constructor

Properties


RegExp.prototype

JS: RegExp.prototype

Reference

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

RegExp Topic

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

String Topic

  1. JS: Default Charset/Encoding
  2. JS: String Code Unit vs Code Point
  3. JS: Unicode Character Escape Sequence
  4. JS: Allowed Characters in Identifier
  5. HTML: Allowed Characters in id Attribute
  6. HTML: Character Sets and Encoding
  7. HTML/XML Entity List

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

  1. JS: String Object
  2. JS: String.prototype
  3. JS: 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