On this page
String.matchAll
Prev: trim | Up: String | Next: substr
Rel: String, String, RegExp & Intl Guide
Ref: MDN Web Docs — String.matchAll
Tags: #public #web #javascript #builtins #string #tier/standard
Signature & Overview
str.matchAll(regexp)
Returns a lazy iterator of all regex match objects including capture groups and indices.
Notes & Pitfalls
- Requires the global
/gflag (throwsTypeErrorwithoutg): Returns an iterator of full match objects including capture groups and.groups.
Example
const matches = [..."a=1 b=2".matchAll(/(?<k>\w+)=(?<v>\d+)/g)];
console.assert(matches.length === 2 && matches[1].groups.k === "b");
Linked from
Related notes
- tuts/javascript/builtins/String/substr Linked here; links to this page; shared tags: #builtins, #javascript, #string, #tier, #web
- tuts/javascript/builtins/String/trim Linked here; links to this page; shared tags: #builtins, #javascript, #string, #tier, #web
- tuts/javascript/builtins/String Linked here; links to this page; shared tags: #builtins, #javascript, #string, #web
- tuts/javascript/builtins/string_regexp_and_intl Linked here; shared tags: #builtins, #javascript, #web
- tuts/javascript/builtins/String/includes shared tags: #builtins, #javascript, #string, #tier, #web
- tuts/javascript/builtins/String/replaceAll shared tags: #builtins, #javascript, #string, #tier, #web
- tuts/javascript/builtins/String/slice shared tags: #builtins, #javascript, #string, #tier, #web
- tuts/javascript/builtins/String/split shared tags: #builtins, #javascript, #string, #tier, #web
- tuts/javascript/builtins/Array/at shared tags: #builtins, #javascript, #tier, #web
- tuts/javascript/builtins/Array/filter shared tags: #builtins, #javascript, #tier, #web