Regular expressionsBaseline · Widely available
The RegExp object represents a regular expression, a notation for matching text patterns.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jul 29, 2015. Widely available since Jan 29, 2018.
Browser support
DesktopChrome
1+Supportedsince Dec 11, 2008
Current: 155Edge
12+Supportedsince Jul 29, 2015
Current: 154Firefox
1+Supportedsince Nov 9, 2004
Current: 157Safari
1+Supportedsince Jun 23, 2003
Current: 27MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155Firefox Android
4+Supportedsince Mar 29, 2011
Current: 157Safari iOS
1+Supportedsince Jun 29, 2007
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: RegExp.
Feature detection
JS · check before using
if (typeof RegExp !== "undefined") {
// RegExp is available
}Sub-features
Support for each part of the feature (52). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| RegExp | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| RegExp.@@match | 50 | 13 | 49 | 10 | 50 | 49 | 10 |
| RegExp.@@matchAll | 73 | 79 | 67 | 13 | 73 | 67 | 13 |
| RegExp.@@replace | 50 | 79 | 49 | 10 | 50 | 49 | 10 |
| RegExp.@@search | 50 | 13 | 49 | 10 | 50 | 49 | 10 |
| RegExp.@@species | 51 | 13 | 49 | 10 | 51 | 49 | 10 |
| RegExp.@@split | 50 | 79 | 49 | 10 | 50 | 49 | 10 |
| RegExp.RegExp | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| RegExp.dotAll | 62 | 79 | 78 | 11.1 | 62 | 79 | 11.3 |
| RegExp.exec | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| RegExp.flags | 49 | 79 | 37 | 9 | 49 | 37 | 9 |
| RegExp.global | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| RegExp.global.prototype_accessor | 48 | 12 | 38 | 1.3 | 48 | 38 | 1 |
| RegExp.hasIndices | 90 | 90 | 88 | 15 | 90 | 88 | 15 |
| RegExp.ignoreCase | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| RegExp.ignoreCase.prototype_accessor | 48 | 12 | 38 | 1.3 | 48 | 38 | 1 |
| RegExp.lastIndex | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| RegExp.multiline | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| RegExp.multiline.prototype_accessor | 48 | 12 | 38 | 1.3 | 48 | 38 | 1 |
| RegExp.source | 1 | 12 | 1 | 1 | 18 | 4 | 1 |