Script/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.prototype[@@match]()

The **` [@@match]() ` ** method of [ ` RegExp ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) instances specifies
how [ ` String.prototype.match() ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/String/match) should behave.
In addition, its presence (or absence) can influence whether an object is
regarded as a regular expression.

##  Try it

##  Syntax

js

    
    
    regexp[Symbol.match](str)
    

###  Parameters

` str `

    

A [ ` String ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
that is a target of the match.

###  Return value

An [ ` Array ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)
whose contents depend on the presence or absence of the global ( ` g ` ) flag,
or [ ` null ` ](/en-US/docs/Web/JavaScript/Reference/Operators/null) if no
matches are found.

  * If the ` g ` flag is used, all results matching the complete regular expression will be returned, but capturing groups are not included. 
  * If the ` g ` flag is not used, only the first complete match and its related capturing groups are returned. In this case, ` match() ` will return the same result as [ ` RegExp.prototype.exec() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) (an array with some extra properties). 

##  Description

This method is called internally in [ ` String.prototype.match() ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/String/match) .

For example, the following two examples return same result.

js

    
    
    "abc".match(/a/);
    
    /a/[Symbol.match]("abc");
    

If the regex is global (with the ` g ` flag), the regex's [ ` exec() ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) method will be
repeatedly called until ` exec() ` returns ` null ` . Otherwise, ` exec() `
would only be called once and its result becomes the return value of ` @@match
` .

Because ` @@match ` would keep calling ` exec() ` until it returns ` null ` ,
and ` exec() ` would automatically reset the regex's [ ` lastIndex ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) to 0 when
the last match fails, ` @@match ` would typically not have side effects when
it exits. However, when the regex is [ sticky ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky) but not global,
` lastIndex `