← TechnologyThe essentials of

matchAll(): all matches with their groups

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 12:40. This is not editorial approval.

In a few sentences

In brief

The result is an iterator that can be traversed.

Useful to know

matchAll() returns an iterator for all matches of a regular expression, including groups. When passed RegExp is required flag g. For example, [..."a1 b2".matchAll(/([a-z])(\d)/g)] contains two results with separate letter and digit . [1]

This is convenient when retrieving text templates. The regular expression should describe the actual expected format. Do not use multiple matches as proof that the entire document is valid. Parsing a complex structured language may require its own parser.

Sources

For further detail and to check the information:

  1. [1] MDN — String.matchAll ↗