From 39f2114f9797eb51994966c6bb8ff1814c9a4da8 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:36:08 +0100 Subject: unslug fr: move --- .../global_objects/regexp/flags/index.html | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 files/fr/web/javascript/reference/global_objects/regexp/flags/index.html (limited to 'files/fr/web/javascript/reference/global_objects/regexp/flags') diff --git a/files/fr/web/javascript/reference/global_objects/regexp/flags/index.html b/files/fr/web/javascript/reference/global_objects/regexp/flags/index.html new file mode 100644 index 0000000000..c110c30d38 --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/regexp/flags/index.html @@ -0,0 +1,80 @@ +--- +title: RegExp.prototype.flags +slug: Web/JavaScript/Reference/Objets_globaux/RegExp/flags +tags: + - ECMAScript 2015 + - JavaScript + - Propriété + - Prototype + - Reference + - RegExp + - polyfill +translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/flags +--- +
{{JSRef}}
+ +

La propriété flags renvoie une chaîne de caractères contenant les drapeaux (flags) de l'objet {{jsxref("RegExp")}} auquel elle appartient.

+ +
{{EmbedInteractiveExample("pages/js/regexp-prototype-flags.html")}}
+ + + +
{{js_property_attributes(0, 0, 1)}}
+ +

Description

+ +

Les drapeaux de la propriété flags sont rangés par ordre alphabétique de gauche à droite.

+ +

Exemples

+ +

Utiliser flags

+ +
/toto/ig.flags;   // "gi"
+/truc/myu.flags;  // "muy"
+
+ +

Prothèse d'émulation (polyfill)

+ +
if (RegExp.prototype.flags === undefined) {
+  Object.defineProperty(RegExp.prototype, 'flags', {
+    configurable: true,
+    get: function() {
+      return this.toString().match(/[gimuy]*$/)[0];
+    }
+  });
+}
+
+ +

Spécifications

+ + + + + + + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('ES2015', '#sec-get-regexp.prototype.flags', 'RegExp.prototype.flags')}}{{Spec2('ES2015')}}Définition initiale.
{{SpecName('ESDraft', '#sec-get-regexp.prototype.flags', 'RegExp.prototype.flags')}}{{Spec2('ESDraft')}} 
+ +

Compatibilité des navigateurs

+ + + +

{{Compat("javascript.builtins.RegExp.flags")}}

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf