Showing content from https://webplatform.github.io/docs/javascript/RegExp/unicode below:
unicode ยท WebPlatform Docs
unicode Summary
Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular expression. Default is false. Read-only.
Syntax
regex.unicode
Examples
The following example illustrates the use of the Unicode property.
var string = 'a๐b';
console.log(/a.b/.unicode);
console.log(/a.b/.test(string));
console.log(/a.b/u.unicode);
console.log(/a.b/u.test(string));
var match = string.match(/a(.)b/u);
console.log(match[1]);
View live example
Remarks
The unicode
property returns true
if the Unicode flag is set for a regular expression, and returns false
if it is not.
The Unicode flag, when used, enables various Unicode-related features for regular expressions, such as the use of ES6 Unicode code point escapes (e.g. /\u{1D306}/u
).
See also Related articles Javascript
Other articles
External resources
- Unicode-aware regular expressions in ECMAScript 6
- regexpu โ a source code transpiler that enables the use of ES6 Unicode regular expressions in ES5
- [Traceur REPL demo](https://google.github.io/traceur-compiler/demo/repl.html#%2F%2F%20Traceur%20now%20uses%20regexpu%20(https%3A%2F%2Fmths.be%2Fregexpu)%20to%20transpile%20regular%0A%2F%2F%20expression%20literals%20that%20have%20the%20ES6%20%60u%60%20flag%20set%20into%20equivalent%20ES5.%0A%0A%2F%2F%20Match%20any%20symbol%20from%20U%2B1F4A9%20PILE%20OF%20POO%20to%20U%2B1F4AB%20DIZZY%20SYMBOL.%0Avar%20regex%20%3D%20%2F%5B%F0%9F%92%A9-%F0%9F%92%AB%5D%2Fu%3B%20%2F%2F%20Or%2C%20%60%2F%5Cu%7B1F4A9%7D-%5Cu%7B1F4AB%7D%2Fu%60.%0Aconsole.log(%0A%20%20regex.test(โ%F0%9F%92%A8โ)%2C%20%2F%2F%20false%0A%20%20regex.test(โ%F0%9F%92%A9โ)%2C%20%2F%2F%20true%0A%20%20regex.test(โ%F0%9F%92%AAโ)%2C%20%2F%2F%20true%0A%20%20regex.test(โ%F0%9F%92%ABโ)%2C%20%2F%2F%20true%0A%20%20regex.test(โ%F0%9F%92%ACโ)%20%20%2F%2F%20false%0A)%3B%0A%0A%2F%2F%20See%20https%3A%2F%2Fmathiasbynens.be%2Fnotes%2Fes6-unicode-regex%20for%20more%20examples%20and%0A%2F%2F%20info.%0A)
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4