🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › matchAll
String.prototype.matchAll() - JavaScript | MDN
The matchAll() method of String values returns an iterator of all results matching this string against a regular expression, including capturing groups.
🌐
Programiz
programiz.com › javascript › library › string › matchall
Javascript String matchAll() (With Examples)
// string definition const sentence = "JavaScript1JavaScript2"; // a pattern having 'JavaScript' followed by a digit const regex = /JavaScript\d/g; // finding matches in the string for the given regular expression let results = sentence.matchAll(regex); // looping through the iterator for (result of results) { console.log(result); } // Output: // ["JavaScript1", index: 0, input: "JavaScript1JavaScript2", groups: undefined] // ["JavaScript2", index: 11, input: "JavaScript1JavaScript2", groups: undefined]
🌐
W3Schools
w3schools.com › jsref › jsref_string_matchall.asp
JavaScript String matchAll() Method
The matchAll() method matches a string against a regular expression **
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › String › matchAll
JavaScript String matchAll() - Match All Occurrences | Vultr Docs
November 14, 2024 - Start with a basic string that includes multiple instances of a simple pattern. Define a regular expression to search for the pattern. Use matchAll() to retrieve all matches and convert the iterator to an array for easier manipulation.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-string-matchall-method
Javascript String matchAll() Method - GeeksforGeeks
July 23, 2025 - The JavaScript matchAll method is very useful for working with regular expressions. It allows developers to find all matches of a pattern in a string, returning an iterator with detailed match results.
🌐
Chrome Developers
developer.chrome.com › blog › better match results with string.prototype.matchall()
Better match results with String.prototype.matchAll() | Blog | Chrome for Developers
What would the explainer examples look like with matchAll()? Have a look. const regex = /t(e)(st(\d?))/g; const string = 'test1test2'; const matches = string.matchAll(regex); for (const match of matches) { console.log(match); }
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › match
String.prototype.match() - JavaScript | MDN
If you want to obtain capture groups and the global flag is set, you need to use RegExp.prototype.exec() or String.prototype.matchAll() instead. For more information about the semantics of match() when a regex is passed, see RegExp.prototype[Symbol.match](). In the following example, match() is used to find "Chapter" followed by one or more numeric characters followed by a decimal point and numeric character zero or more times.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › RegExp › Symbol.matchAll
RegExp.prototype[Symbol.matchAll]() - JavaScript | MDN
If the current match is an empty string, the lastIndex will still be advanced. If the regex has the u flag, it advances by one Unicode code point; otherwise, it advances by one UTF-16 code point. ... console.log(Array.from("😄".matchAll(/(?:)/g))); // [ [ "" ], [ "" ], [ "" ] ] console.log(Array.from("😄".matchAll(/(?:)/gu))); // [ [ "" ], [ "" ] ]
🌐
Codecademy
codecademy.com › docs › javascript › strings › matchall()
JavaScript | Strings | matchAll() | Codecademy
June 22, 2025 - The matchAll() method is a built-in JavaScript function that returns an iterator of all matches of a regular expression within a string.
Find elsewhere
🌐
CodeSweetly
codesweetly.com › javascript-string-match-all-method
matchAll() JavaScript String Method – Explained with Examples | CodeSweetly
matchAll() creates a new iterator object containing all the patterns—including capturing groups—that match the method's regular expression argument.
🌐
Medium
medium.com › nerd-for-tech › basics-of-javascript-string-matchall-method-1dd7fdc90e21
Basics of Javascript · String · matchAll() (method) | by Jakub Korch | Nerd For Tech | Medium
June 10, 2021 - The matchAll() method returns an iterator of all results matching a string against a regular expression, including capturing groups.
🌐
Educative
educative.io › answers › what-is-stringmatchall-in-javascript
What is string.matchall() in JavaScript?
The matchAll() function matches a string against a regular expression and returns an iterator of all the matched groups.
🌐
W3Schools
w3schools.com › js › js_string_search.asp
JavaScript String Search
Read more about regular expressions in the chapter JS RegExp. The matchAll() method returns an iterator containing the results of matching a string against a string (or a regular expression).
🌐
GitHub
github.com › tc39 › proposal-string-matchall
GitHub - tc39/proposal-string-matchall: ES Proposal, specs, tests, reference implementation, and polyfill/shim for String.prototype.matchAll
Update from committee feedback: ruby uses the word scan for this, but the committee is not comfortable introducing a new word to JavaScript. matchEach was suggested, but some were not comfortable with the naming similarity to forEach while the API was quite different. matchAll seems to be the name everyone is most comfortable with. In the September 2017 TC39 meeting, there was a question raised about whether "all" means "all overlapping matches" or "all non-overlapping matches" - where “overlapping” means “all matches starting from each character in the string”, and “non-overlapping” means “all matches starting from the beginning of the string”. We briefly considered either renaming the method, or adding a way to achieve both semantics, but the objection was withdrawn.
Starred by 99 users
Forked by 8 users
🌐
W3Schools
w3schools.com › jsref › jsref_match.asp
JavaScript String match() Method
break class const continue debugger do...while for for...in for...of function if...else let return switch throw try...catch var while JS Strings · at() charAt() charCodeAt() codePointAt() concat() constructor endsWith() fromCharCode() includes() indexOf() isWellFormed() lastIndexOf() length localeCompare() match() matchAll() padEnd() padStart() prototype repeat() replace() replaceAll() search() slice() split() startsWith() substr() substring() toLocaleLowerCase() toLocaleUpperCase() toLowerCase() toString() toUpperCase() toWellFormed() trim() trimEnd() trimStart() valueOf() JS Typed Arrays ·
🌐
Tildeloop
blog.tildeloop.com › posts › javascript-the-difference-between-match-and-matchall
JavaScript: The difference between match() and matchAll() - Tilde Loop Blog
This is where matchAll() comes in. String.prototype.matchAll() returns an iterator that returns all matched groups against a regular expression, including capturing groups.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Symbol › matchAll
Symbol.matchAll - JavaScript | MDN
const str = "2016-01-02|2019-03-07"; const numbers = { *[Symbol.matchAll](str) { for (const n of str.matchAll(/\d+/g)) yield n[0]; }, }; console.log(Array.from(str.matchAll(numbers))); // ["2016", "01", "02", "2019", "03", "07"]
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Regular_expressions
Regular expressions - JavaScript | MDN
Regular expressions are patterns used to match character combinations in strings. In JavaScript, regular expressions are also objects. These patterns are used with the exec() and test() methods of RegExp, and with the match(), matchAll(), replace(), replaceAll(), search(), and split() methods ...