aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/regexp/hasindices
diff options
context:
space:
mode:
authorSphinxKnight <SphinxKnight@users.noreply.github.com>2021-12-27 11:29:51 +0100
committerGitHub <noreply@github.com>2021-12-27 11:29:51 +0100
commitfcf2f3fc1ee9dfccd7aa745cc67d68253190fed6 (patch)
treee53f1013e74b43bebce6a2396605ea5a4c6eea9d /files/fr/web/javascript/reference/global_objects/regexp/hasindices
parentf429ecdb75bc924597575216978d2ac5bec8cce6 (diff)
downloadtranslated-content-fcf2f3fc1ee9dfccd7aa745cc67d68253190fed6.tar.gz
translated-content-fcf2f3fc1ee9dfccd7aa745cc67d68253190fed6.tar.bz2
translated-content-fcf2f3fc1ee9dfccd7aa745cc67d68253190fed6.zip
Translate missing RegExp pages (#3198)
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/regexp/hasindices')
-rw-r--r--files/fr/web/javascript/reference/global_objects/regexp/hasindices/index.md62
1 files changed, 62 insertions, 0 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/regexp/hasindices/index.md b/files/fr/web/javascript/reference/global_objects/regexp/hasindices/index.md
new file mode 100644
index 0000000000..5fc456f36e
--- /dev/null
+++ b/files/fr/web/javascript/reference/global_objects/regexp/hasindices/index.md
@@ -0,0 +1,62 @@
+---
+title: RegExp.prototype.hasIndices
+slug: Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices
+translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices
+browser-compat: javascript.builtins.RegExp.hasIndices
+---
+{{JSRef}}
+
+La propriété **`hasIndices`** indique si le marqueur "`d`" a été utilisé ou non avec l'expression rationnelle. `hasIndices` est une propriété en lecture seule, rattachée à une instance d'expression rationnelle.
+
+{{EmbedInteractiveExample("pages/js/regexp-prototype-hasindices.html")}}
+
+{{JS_Property_Attributes(0, 0, 1)}}
+
+## Description
+
+La valeur de `hasIndices` est un [`booléen`](/fr/docs/Web/JavaScript/Reference/Global_Objects/Boolean) qui vaut `true` si le marqueur "`d`" a été utilisé et `false` sinon. Le marqueur "`d`" indique que le résultat des correspondances d'une expression rationnelle devrait contenir les indices de début et fin des fragments de chaîne pour chaque groupe capturant.
+
+Cette propriété ne peut être modifiée directement.
+
+## Exemples
+
+### Utiliser `hasIndices`
+
+```js
+const str1 = 'toto truc toto';
+
+const regex1 = new RegExp('toto', 'gd');
+
+console.log(regex1.hasIndices); // Affiche : true
+
+console.log(regex1.exec(str1).indices[0]); // Affiche : Array [0, 3]
+console.log(regex1.exec(str1).indices[0]); // Affiche : Array [8, 11]
+
+const str2 = 'toto truc toto';
+
+const regex2 = new RegExp('toto');
+
+console.log(regex2.hasIndices); // Affiche : false
+
+console.log(regex2.exec(str2).indices); // Affiche : undefined
+```
+
+## Spécifications
+
+{{Specifications}}
+
+## Compatibilité des navigateurs
+
+{{Compat}}
+
+## Voir aussi
+
+- [`RegExp.lastIndex`](/fr/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex)
+- [`RegExp.prototype.exec()`](/fr/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec)
+- [`RegExp.prototype.dotAll`](/fr/docs/Web/JavaScript/Reference/Global_Objects/RegExp/dotAll)
+- [`RegExp.prototype.global`](/fr/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global)
+- [`RegExp.prototype.ignoreCase`](/fr/docs/Web/JavaScript/Reference/Global_Objects/RegExp/ignoreCase)
+- [`RegExp.prototype.multiline`](/fr/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline)
+- [`RegExp.prototype.source`](/fr/docs/Web/JavaScript/Reference/Global_Objects/RegExp/source)
+- [`RegExp.prototype.sticky`](/fr/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky)
+- [`RegExp.prototype.unicode`](/fr/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicode)