unicode property indicates whether or not the " u " flag is used with a regular expression. unicode is a read-only property of an individual regular expression instance.

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

特性属性在 RegExp.prototype.unicode
可写 no
可枚举 no
可配置 yes

描述

unicode 布尔 and true if the " u " flag was used; otherwise false . The " u " flag enables various Unicode-related features. With the "u" flag, any Unicode code point escapes will be interpreted as such, for example.

You cannot change this property directly. It is read-only.

范例

使用 unicode property

var regex = new RegExp('\u{61}', 'u');
console.log(regex.unicode); // true
					

规范

规范
ECMAScript (ECMA-262)
The definition of 'RegExp.prototype.unicode' in that specification.

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 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
unicode Chrome 50 Edge 12
12
Case folding is implemented in version 13
Firefox 46 IE No Opera 37 Safari 10 WebView Android 50 Chrome Android 50 Firefox Android 46 Opera Android 37 Safari iOS 10 Samsung Internet Android 5.0 nodejs Yes

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

另请参阅

元数据

  • 最后修改: