pt/Reference/Global_Objects/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 
  * Syntax 
  * Description 
  * Examples 
  * Specifications 
  * Browser compatibility 
  * See also 

#  RegExp[@@species]

The **` RegExp[@@species] ` ** static accessor property returns the
constructor used to construct copied regular expressions in certain ` RegExp `
methods.

**Warning:** The existence of ` @@species ` allows execution of arbitrary code
and may create security vulnerabilities. It also makes certain optimizations
much harder. Engine implementers are [ investigating whether to remove this
feature ](https://github.com/tc39/proposal-rm-builtin-subclassing) . Avoid
relying on it if possible.

##  Try it

##  Syntax

js

    
    
    RegExp[Symbol.species]
    

###  Return value

The value of the constructor ( ` this ` ) on which ` get @@species ` was
called. The return value is used to construct copied ` RegExp ` instances.

##  Description

The ` @@species ` accessor property returns the default constructor for `
RegExp ` objects. Subclass constructors may override it to change the
constructor assignment. The default implementation is basically:

js

    
    
    // Hypothetical underlying implementation for illustration
    class RegExp {
      static get [Symbol.species]() {
        return this;
      }
    }
    

Because of this polymorphic implementation, ` @@species ` of derived
subclasses would also return the constructor itself by default.

js

    
    
    class SubRegExp extends SubRegExp {}
    SubRegExp[Symbol.species] === SubRegExp; // true
    

Some ` RegExp ` methods create a copy of the current regex instance before
running [ ` exec() ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) , so that side
effects such as changes to [ ` lastIndex ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) are not
retained. The ` @@species ` property is used to determine the constructor of
the new instance. The methods that copy the current regex instance are:

  * [ ` [@@matchAll]() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/@@matchAll)
  * [ ` [@@split]() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/@@split)

##  Examples

###  Species in ordinary objects

The ` @@species ` property returns the default constructor function, which is
the ` RegExp ` constructor for ` RegExp ` objects:

js

    
    
    RegExp[Symbol.species]; // function RegExp()
    

###  Species in derived objects

In an instance of a custom ` RegExp ` subclass, such as ` MyRe