String.prototype.matchAlladvancedconst str = 'a1 b2 c3'
const matches = [...str.matchAll(/(w)(d)/g)]
matches.length // β 3
matches[0][1] // β 'a'Use matchAll() with the g flag to iterate over all regex matches and access capture groups in each result.
Named groups from each match are in match.groups.
Challenge: Implement extractKeyValues(str) that parses key=value pairs from a string.
extractKeyValues('a=1 b=2 c=3') // β [{ key: 'a', value: '1' }, ...]