JS TutorialLesson #99

RegExp Methods

[JavaScript RegExp Tutorial](jsregexp.asp)

Complete RexExp Reference

Revised July 2025

NameDescription
compile()Compiles a regular expression (Deprecated)
constructorReturns the function that created the RegExp prototype
dotAllReturns true if the s flag is set in the expression (new in 2018)
escape()Returns a string where characters that belongs to the regular expression syntax are escaped (new in 2025)
exec()Returns a result array for a matches in a string
flagsReturns the modifiers set in the expression (new in 2015)
globalReturns true if the g flag is set in the expression
hasIndicesReturns true if the d flag is set (new in 2022)
ignoreCaseReturns true if the i flag is set
lastIndexSpecifies the index at which to start the next match
multilineReturns true if the m modifier is set
sourceReturns the text of the RegExp pattern
stickyReturns true if the y flag is set (new in 2015)
test()Tests for a match in a string. Returns true or false
toString()Returns the string value of the regular expression
unicodeReturns true if the u flag is set (new in 2018)
unicodeSetsReturns true if the v flag is set (new in 2023)

RegExp String Methods

MethodDescription
match(regexp)Returns an Array of results
matchAll(regexp)Returns an Iterator of results
replace(regexp, s)Returns a new String
replaceAll(regexp, s)Returns a new String
search(regexp)Returns the index of the first match
split(regexp)Returns an Array of results

Share

See Also:

JavaScript RegExp Tutorial

JavaScript RegExp Flags

JavaScript RegExp Character Classes

JavaScript RegExp Meta Characters

JavaScript RegExp Assertions

JavaScript RegExp Groups

JavaScript RegExp Quantifiers

JavaScript RegExp Patterns

JavaScript RegExp Objects