coderef

String matchAll()Baseline · Widely available

The matchAll() method of strings matches a string against a regular expression and returns an iterator of all results, including capturing groups.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jan 15, 2020. Widely available since Jul 15, 2022.

Browser support

DesktopChrome
1–72Not supported
73+Supportedsince Mar 12, 2019
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–66Not supported
67+Supportedsince May 21, 2019
Current: 157
Safari
1–12.1Not supported
13+Supportedsince Sep 19, 2019
Current: 27
MobileChrome Android
18–72Not supported
73+Supportedsince Mar 12, 2019
Current: 155
Firefox Android
4–66Not supported
67+Supportedsince May 21, 2019
Current: 157
Safari iOS
1–12.2Not supported
13+Supportedsince Sep 19, 2019
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: matchAll.

Feature detection

JS · check before using
if ("matchAll" in String || ("prototype" in String && "matchAll" in String.prototype)) {
  // String.matchAll is available
}

Documentation (MDN)

Specification