aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/symbol/match/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/symbol/match/index.html')
-rw-r--r--files/fr/web/javascript/reference/global_objects/symbol/match/index.html78
1 files changed, 0 insertions, 78 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/symbol/match/index.html b/files/fr/web/javascript/reference/global_objects/symbol/match/index.html
deleted file mode 100644
index c1b0aed572..0000000000
--- a/files/fr/web/javascript/reference/global_objects/symbol/match/index.html
+++ /dev/null
@@ -1,78 +0,0 @@
----
-title: Symbol.match
-slug: Web/JavaScript/Reference/Global_Objects/Symbol/match
-tags:
- - ECMAScript 2015
- - JavaScript
- - Propriété
- - Reference
- - Symbol
-translation_of: Web/JavaScript/Reference/Global_Objects/Symbol/match
-original_slug: Web/JavaScript/Reference/Objets_globaux/Symbol/match
----
-<div>{{JSRef}}</div>
-
-<p>Le symbole <code><strong>Symbol.match</strong></code> définit la correspondance d'une expression rationnelle par rapport à une chaîne de caractères. Cette fonction est appelée par la méthode {{jsxref("String.prototype.match()")}}.</p>
-
-<div>{{EmbedInteractiveExample("pages/js/symbol-match.html")}}</div>
-
-
-
-<h2 id="Description">Description</h2>
-
-<p>Cette fonction est également utilisée pour identifier les objets qui jouent un rôle avec les expressions rationnelles. Ainsi, les méthodes {{jsxref("String.prototype.startsWith()")}}, {{jsxref("String.prototype.endsWith()")}} et {{jsxref("String.prototype.includes()")}} vérifient si leur premier argument est une expression rationnelle et lèvent une exception {{jsxref("TypeError")}} si c'est le cas. Si le symbole <code>match</code> est modifié et vaut une valeur <code>false</code> (ou équivalente), cela indique que l'objet ne doit pas être utilisé comme une expression rationnelle.</p>
-
-<p>{{js_property_attributes(0,0,0)}}</p>
-
-<h2 id="Exemples">Exemples</h2>
-
-<p>Le code suivant renverra une exception {{jsxref("TypeError")}} :</p>
-
-<pre class="brush: js">"/truc/".startsWith(/truc/);
-
-// lève une TypeError car /truc/
-// est une expression rationnelle
-// et que Symbol.match n'a pas été modifié.</pre>
-
-<p>Cependant, si <code>Symbol.match</code> vaut <code>false</code>, cette vérification <code>isRegExp</code> indiquera que l'objet à prendre en compte n'est pas une expression rationnelle. Les méthodes <code>startsWith</code> et <code>endsWith</code> ne déclencheront donc pas d'exception <code>TypeError</code>.</p>
-
-<pre class="brush: js">var re = /toto/;
-re[Symbol.match] = false;
-"/toto/".startsWith(re); // true
-"/truc/".endsWith(re); // false
-</pre>
-
-<h2 id="Spécifications">Spécifications</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Spécification</th>
- <th scope="col">État</th>
- <th scope="col">Commentaires</th>
- </tr>
- <tr>
- <td>{{SpecName('ES2015', '#sec-symbol.match', 'Symbol.match')}}</td>
- <td>{{Spec2('ES2015')}}</td>
- <td>Définition initiale.</td>
- </tr>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-symbol.match', 'Symbol.match')}}</td>
- <td>{{Spec2('ESDraft')}}</td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
-
-<p>{{Compat("javascript.builtins.Symbol.match")}}</p>
-
-<h2 id="Voir_aussi">Voir aussi</h2>
-
-<ul>
- <li>{{jsxref("Symbol.replace")}}</li>
- <li>{{jsxref("Symbol.search")}}</li>
- <li>{{jsxref("Symbol.split")}}</li>
- <li>{{jsxref("RegExp.@@match", "RegExp.prototype[@@match]()")}}</li>
-</ul>