pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/RegExp/flags

-4bdf-a490-390a1aebf6dd/airgap.js" >

Cette page a été traduite à partir de l'anglais par la communauté. Vous pouvez contribuer en rejoignant la communauté francophone sur MDN Web Docs.

View in English Always switch to English

RegExp.prototype.flags

Baseline Large disponibilité

Cette fonctionnalité est bien établie et fonctionne sur de nombreux appareils et versions de navigateurs. Elle est disponible sur tous les navigateurs depuis janvier 2020.

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

Exemple interactif

// Outputs RegExp flags in alphabetical order

console.log(/foo/gi.flags);
// Expected output: "gi"

console.log(/bar/muy.flags);
// Expected output: "muy"
Attributs de RegExp.prototype.flags
ÉcrivableNon
ÉnumérableNon
ConfigurableOui

Description

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

Exemples

Utiliser flags

js
/toto/gi.flags; // "gi"
/truc/muy.flags; // "muy"

Prothèse d'émulation (polyfill)

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

Spécifications

Spécification
ECMAScript® 2027 Language Specification
# sec-get-regexp.prototype.flags

Compatibilité des navigateurs

Voir aussi

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy