RegExp.prototype.dotAll

草案
本页尚未完工.

dotAll 属性表明是否在正则表达式中一起使用"s"修饰符(引入/s修饰符,使得.可以匹配任意单个字符)。dotAll 是一个只读的属性,属于单个正则表达式实例。

RegExp.prototype.dotAll 属性的属性特性:
writable false
enumerable false
configurable true

描述

如果使用了"s"修饰符,dotAll 的值将返回Boolean类型的true,否则将返回false。"s"修饰符表示,特殊字符"."应另外匹配字符串中的下述行终结符(line terminator characters),否则将会失配:

  • U+000A 换行符("\n")
  • U+000D 回车符("\r")
  • U+2028 行分隔符(line separator
  • U+2029 段分隔符(paragraph separator

这实际上意味着"."将会匹配任意的单个Unicode Basic Multilingual Plane (BMP)字符。若要使其与astral字符(大于\uFFFF的Unicode字符)匹配,你应当使用"u"(Unicode)修饰符。一起使用这两个修饰符,"."将无一例外地匹配任意Unicode字符。

无法直接修改此属性。

浏览器兼容性

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
dotAll Chrome Full support 62 Edge No support No Firefox No support No IE No support No Opera Full support 49 Safari Full support 12 WebView Android Full support 62 Chrome Android Full support 62 Firefox Android No support No Opera Android Full support 46 Safari iOS Full support 12 Samsung Internet Android Full support 8.0 nodejs Full support 8.10.0
Full support 8.10.0
Full support 8.3.0
Disabled
Disabled From version 8.3.0: this feature is behind the --harmony runtime flag.

Legend

Full support  
Full support
No support  
No support
User must explicitly enable this feature.
User must explicitly enable this feature.

相关链接