/Object/constructor)
    2. [ ` Object.prototype.__proto__ ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) Deprecated 
  13. Methods 
    1. [ ` Object.prototype.__defineGetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__) Deprecated 
    2. [ ` Object.prototype.__defineSetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineSetter__) Deprecated 
    3. [ ` Object.prototype.__lookupGetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__lookupGetter__) Deprecated 
    4. [ ` Object.prototype.__lookupSetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__lookupSetter__) Deprecated 
    5. [ ` Object.prototype.hasOwnProperty() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty)
    6. [ ` Object.prototype.isPrototypeOf() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf)
    7. [ ` Object.prototype.propertyIsEnumerable() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable)
    8. [ ` Object.prototype.toLocaleString() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toLocaleString)
    9. [ ` Object.prototype.toString() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString)
    10. [ ` Object.prototype.valueOf() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf)

##  In this article

  * Try it 
  * Description 
  * Examples 
  * Specifications 
  * Browser compatibility 
  * See also 

#  RegExp.prototype.flags

The **` flags ` ** accessor property of [ ` RegExp ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) instances returns the
[ flags ](/en-
US/docs/Web/JavaScript/Guide/Regular_expressions#advanced_searching_with_flags)
of this regular expression.

##  Try it

##  Description

` RegExp.prototype.flags ` has a string as its value. Flags in the ` flags `
property are sorted alphabetically (from left to right, e.g. ` "dgimsuvy" ` ).
It actually invokes the other flag accessors ( [ ` hasIndices ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices) , [ `
global ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global)
, etc.) one-by-one and concatenates the results.

All built-in functions read the ` flags ` property instead of reading
individual flag accessors.

The set accessor of ` flags ` is ` undefined ` . You cannot change this
property directly.

##  Examples

###  Using flags

js

    
    
    /foo/ig.flags; // "gi"
    /bar/myu.flags; // "muy"
    

##  Specifications

Specification  
---  
[ ECMAScript Language Specification  
#  sec-get-regexp.prototype.flags  ](https://tc39.es/ecma262/multipage/text-
processing.html#sec-get-regexp.prototype.flags)  
  
##  Browser compatibility

BCD tables only load in the browser  with JavaScript enabled. Enable
JavaScript to view data.

##  See also

  * [ Polyfill of ` RegExp.prototype.flags ` in ` core-js ` ](https://github.com/zloirock/core-js#ecmascript-string-and-regexp)
  * [ Advanced searching with flags ](/en-US/docs/Web/JavaScript/Guide/Regular_expressions#advanced_searching_with_flags) in the Regular expressions guide 
  * [ ` RegExp.prototype.source ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/source)

##  Help improve MDN

Was this page helpful to you?

Yes  No

[ Learn how to contribute
](https://github.com/mdn/content/blob/main/CONTRIBUTING.md "This will take you
to our contribution guidelines on GitHub.") .

This page was last modified on  Dec 23, 2023  by  [ MDN contributors ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/flags/contributors.txt)
.

[ View this page on GitHub
](https://github.com/mdn/content/blob/main/files/en-
us/web/javascript/reference/global_objects/regexp/flags/index.md?plain=1
"Folder: en-us/web/javascript/reference/global_objects/regexp/flags \(Opens in
a new tab\)") â¢  [ Report a problem with thi