Back to Blog
Web DevelopmentProgramming Languages
5 April 20263 min readUpdated 5 April 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...
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
sflag 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
trueif thegflag is active. - hasIndices: Displays
trueif thedflag is set. (Introduced in 2022) - ignoreCase: Returns
trueif theiflag is active. - lastIndex: Determines the index at which to start the next match.
- multiline: Indicates
trueif themmodifier is applied. - source: Returns the text of the RegExp pattern.
- sticky: Shows
trueif theyflag is set. (Introduced in 2015) - test(): Tests for a match in a string, returning
trueorfalse. - toString(): Returns the string representation of the regular expression.
- unicode: Shows
trueif theuflag is set. (Introduced in 2018) - unicodeSets: Indicates
trueif thevflag is used. (Introduced in 2023)

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