A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Symbol/matchAll below:

Symbol.matchAll - JavaScript | MDN

Symbol.matchAll

Baseline Widely available

Le symbole connu Symbol.matchAll renvoie un itérateur qui fournit l'ensemble des correspondances entre une expression rationnelle et une chaîne de caractères. Cette fonction est implicitement appelée par la méthode String.prototype.matchAll().

Exemple interactif
const re = /[0-9]+/g;
const str = "2016-01-02|2019-03-07";
const result = re[Symbol.matchAll](str);

console.log(Array.from(result, (x) => x[0]));
// Expected output: Array ["2016", "01", "02", "2019", "03", "07"]
Description

Ce symbole est utilisé par String.prototype.matchAll() et plus particulièrement par RegExp.prototype[@@matchAll](). Les deux lignes qui suivent renverront le même résultat :

"abc".matchAll(/a/);

/a/[Symbol.matchAll]("abc");

Cette méthode existe afin de personnaliser le comportement des correspondances pour les sous-classes de RegExp.

Écrivable Non Énumérable Non Configurable Non Exemples

Voir les pages String.prototype.matchAll() et RegExp.prototype[@@matchAll]() pour plus d'exemples.

Spécifications Compatibilité des navigateurs Voir aussi

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4