Widely availableRecommended when you need every match plus capture metadata in one readable iteration flow.

Overview

String.prototype.matchAll() returns an iterator of every match for a global regular expression, including capturing groups. It is often cleaner than a manual exec loop.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
73
79
67
13
73
13
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

JAVASCRIPT
const text = 'Price: ¥1,200, ¥3,500, and ¥800';
const regex = /¥([\d,]+)/g;

for (const match of text.matchAll(regex)) {
  console.log(match[0], match[1]);
}
// '¥1,200' '1,200'
// '¥3,500' '3,500'
// '¥800' '800'

Live demo

Multiplematch. batchread

Textinside. all. priceinfo extract, detail display..

PreviewFullscreen

HTMLtag. Attributeextract

regex. kipchagroup Use, all. link. URL and text extract..

PreviewFullscreen

dynamicgenerate with Iterateprocessing.

MatchAll that itere-ta Use, show or word listization..

PreviewFullscreen

Use cases

  • Extracting repeated patterns

    Pull prices, links, tags, or identifiers from a text block while preserving capture groups.

  • Building derived lists

    Iterate over all matches to create result rows, summaries, or highlighted tokens.

Cautions

  • matchAll requires a global regular expression, so remember the g flag or it will throw.
  • Complex regular expressions can still be hard to debug, so keep the pattern readable and well tested.

Accessibility

  • When extracted text becomes a list or summary in the UI, present the results with clear headings and counts rather than dumping raw output.

Powered by web-features