JS: RegExp Object

By Xah Lee. Date: . Last updated: .

RegExp is the value of the property key "RegExp" of the global object. [JS: the Global Object]

console.log( window.RegExp === RegExp ); // true

Type

RegExp is a function.

[see JS: Value Types]

// type of RegExp
console.log ( typeof RegExp === "function" ); // true

Parent

Parent of RegExp is Function.prototype. [see JS: Prototype and Inheritance]

console.log ( Reflect.getPrototypeOf ( RegExp ) === Function.prototype ); // true

Purpose

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.

For a beginner tutorial, see JS: RegExp Tutorial

For a summary of regex methods, see JS: Regex Find/Replace

RegExp Constructor

JS: RegExp Constructor

Properties

JS RegExp

  1. RegExp Tutorial
  2. RegExp Syntax
  3. Regex Find/Replace

JS String

  1. String Overview
  2. Template String
  3. Char, Code Unit, Codepoint
  4. String Escape Sequence
  5. Unicode Escape Sequence

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 it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

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

Web Dev Tutorials