Symbol.matchAll

Symbol.matchAll 返回一个迭代器,该迭代器根据字符串生成正则表达式的匹配项。此函数可以被 String.prototype.matchAll() 方法调用。

描述

此Symbol用于 RegExp.prototype[@@matchAll]()。下面两个例子返回相同的结果:

'abc'.matchAll(/a/);

/a/[Symbol.matchAll]('abc');

此方法用于自定义 RegExp 子类中的匹配行为。

Symbol.matchAll 属性的属性特性:
writable false
enumerable false
configurable false

示例

更多示例请查阅 RegExp.prototype[@@matchAll]()

规范

文档 状态 备注
ECMAScript Latest Draft (ECMA-262)
Symbol.matchAll
Draft  

浏览器支持

Update compatibility data on GitHub
Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
matchAll Chrome Full support 73 Edge No support No Firefox Full support 67 IE No support No Opera Full support 60 Safari No support No WebView Android Full support 73 Chrome Android Full support 73 Firefox Android Full support 67 Opera Android Full support Yes Safari iOS No support No Samsung Internet Android No support No nodejs Full support 12.0.0

Legend

Full support  
Full support
No support  
No support

相关链接