Prototype Methods

exec() returns a match array (with index, groups and, with d, indices) or null; test() returns a boolean; toString() returns /source/flags. String methods delegate to the regex: s.match(r) calls its Symbol.match method, and likewise for matchAll, replace, search and split.

Parsing log lines with matchAll(), exec(), split() and a replacer functionJavaScriptLive
const log = 'GET /home 200 12ms\nPOST /api/cart 500 340ms';
const line = /^(?<method>[A-Z]+) (?<path>\S+) (?<status>\d{3}) (?<ms>\d+)ms$/gm;
for (const { index, groups: g } of log.matchAll(line)) {
  console.log(index, g.method, g.path, g.status, Number(g.ms));
}
console.log(line.exec(log).groups.path, line.lastIndex);   // exec() with g resumes from lastIndex
console.log('a1b22c'.split(/(\d+)/), String(/a/gi));
console.log('Total: 5 + 7'.replace(/\d+/g, (n) => n * 2));

Prefer matchAll() to an exec() loop: it iterates a copy and leaves lastIndex alone. For query strings use URLSearchParams (URLSearchParams) rather than a regex.