The 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.
Property attributes of RegExp.prototype.unicode |
|
|---|---|
| Writable | no |
| Enumerable | no |
| Configurable | yes |
Description
The value of unicode is a Boolean 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.
Examples
Using the unicode property
var regex = new RegExp('\u{61}', 'u');
console.log(regex.unicode); // true
Specifications
| Specification |
|---|
| ECMAScript (ECMA-262) The definition of 'RegExp.prototype.unicode' in that specification. |
Browser compatibility
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.
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
unicode | Chrome Full support 50 | Edge
Full support
12
| Firefox Full support 46 | IE No support No | Opera Full support 37 | Safari Full support 10 | WebView Android Full support 50 | Chrome Android Full support 50 | Firefox Android Full support 46 | Opera Android Full support 37 | Safari iOS Full support 10 | Samsung Internet Android Full support 5.0 | nodejs Full support Yes |
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.
- See implementation notes.
