JavaScript RegExp Reference
New to JavaScript RegExp?
Complete RexExp Reference
Revised July 2025
| Name | Description | 
|---|---|
| compile() | Compiles a regular expression (Deprecated) | 
| constructor | Returns the function that created the RegExp prototype | 
| dotAll | Returns trueif 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 | 
| flags | Returns the modifiers set in the expression (new in 2015) | 
| global | Returns trueif the g flag is set in the expression | 
| hasIndices | Returns trueif the d flag is set (new in 2022) | 
| ignoreCase | Returns trueif the i flag is set | 
| lastIndex | Specifies the index at which to start the next match | 
| multiline | Returns trueif the m modifier is set | 
| source | Returns the text of the RegExp pattern | 
| sticky | Returns trueif the y flag is set(new in 2015) | 
| test() | Tests for a match in a string. Returns trueorfalse | 
| toString() | Returns the string value of the regular expression | 
| unicode | Returns trueif the u flag is set(new in 2018) | 
| unicodeSets | Returns trueif the v flag is set(new in 2023) | 
RegExp String Methods
| Method | Description | 
|---|---|
| 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 | 
Browser Support
/regexp/ is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera | 
 
