Skip to main content
Back to Blog
Web DevelopmentProgramming Languages
4 August 20263 min readUpdated 24 August 2026

Understanding RegExp Methods in JavaScript

RegExp Methods Comprehensive RegExp Reference Updated July 2025 Below is a list of essential methods and properties associated with JavaScript's RegExp objects, helping develope...

By Software Development Team

Understanding RegExp Methods in JavaScript

RegExp Methods


Comprehensive RegExp Reference

Updated July 2025

Below is a list of essential methods and properties associated with JavaScript's RegExp objects, helping developers efficiently utilize regular expressions.

  • compile(): Compiles a regular expression. (Deprecated)
  • constructor: Returns the function that created the RegExp prototype.
  • dotAll: Indicates if the s flag is set in the expression. (Introduced in 2018)
  • escape(): Provides a string with special characters escaped. (Introduced in 2025)
  • exec(): Produces a result array for matches in a string.
  • flags: Returns the modifiers set in the expression. (Introduced in 2015)
  • global: Shows true if the g flag is active.
  • hasIndices: Displays true if the d flag is set. (Introduced in 2022)
  • ignoreCase: Returns true if the i flag is active.
  • lastIndex: Determines the index at which to start the next match.
  • multiline: Indicates true if the m modifier is applied.
  • source: Returns the text of the RegExp pattern.
  • sticky: Shows true if the y flag is set. (Introduced in 2015)
  • test(): Tests for a match in a string, returning true or false.
  • toString(): Returns the string representation of the regular expression.
  • unicode: Shows true if the u flag is set. (Introduced in 2018)
  • unicodeSets: Indicates true if the v flag is used. (Introduced in 2023)

Illustration for: - compile(): Compiles a regula...


RegExp String Methods

These methods allow strings to interact with regular expressions, providing powerful text manipulation capabilities.

  • match(regexp): Returns an array of results.
  • matchAll(regexp): Provides an iterator of results.
  • replace(regexp, s): Produces a new string with replacements.
  • replaceAll(regexp, s): Generates a new string with all replacements.
  • search(regexp): Returns the index of the first match.
  • split(regexp): Divides the string into an array based on the regular expression.

See Also:

Explore additional resources to deepen your understanding of regular expressions in JavaScript:

  • JavaScript RegExp Tutorial
  • JavaScript RegExp Flags
  • JavaScript RegExp Character Classes
  • JavaScript RegExp Meta Characters
  • JavaScript RegExp Assertions
  • JavaScript RegExp Quantifiers
  • JavaScript RegExp Patterns
  • JavaScript RegExp Objects