Skip to main content
Version: 4.0.1

Symbol.match

The Symbol.match well-known symbol specifies the matching of a regular expression against a string. This function is called by the String.prototype.match() method.

For more information, see RegExp.prototype[Symbol.match]() and String.prototype.match().

Value​

The well-known symbol Symbolmatch.

Description​

This function is also used to identify if objects have the behavior of regular expressions. For example, the methods String.prototype.startsWith(), String.prototype.endsWith() and String.prototype.includes(), check if their first argument is a regular expression and will throw a TypeError if they are. Now, if the match symbol is set to false (or a Falsy value except undefined), it indicates that the object is not intended to be used as a regular expression object.