Intent to ship: Unicode property escapes in regular expressions

35 views
Skip to first unread message

Mathias Bynens

unread,
Nov 9, 2017, 4:29:49 PM11/9/17
to blink-dev, v8-users, Yang Guo

Contact emails

yan...@chromium.org, mat...@chromium.org


Spec

https://github.com/tc39/proposal-regexp-unicode-property-escapes (stage 3 proposal)


Summary

The Unicode Standard assigns various properties and property values to every symbol. For example, to get the set of symbols that are used exclusively in the Greek script, search the Unicode database for symbols whose Script property is set to Greek.


Unicode property escapes are a new type of escape sequence available in regular expressions that have the u flag set. They enable querying the Unicode database for certain properties and values.


E.g. /\p{Script=Greek}/u.test('π') === true


Link to “Intent to Implement” blink-dev discussion

There was none.


Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


Demo link

None. The explainer in the proposal offers some examples.


Interoperability and Compatibility Risk

In regular expressions without the u flag, the pattern \p is an (unnecessary) escape sequence for p. Patterns of the form \p{Letter} might already be present in existing regular expressions without the u flag, and therefore we cannot assign new meaning to such patterns without breaking backwards compatibility.


For this reason, ECMAScript 2015 made unnecessary escape sequences like \p and \P throw an exception when the u flag is set. This enables us to change the meaning of \p{…} and \P{…} in regular expressions with the u flag without breaking backwards compatibility.



Is this feature fully tested?

Yes. In addition to V8’s own tests (v8/test/mjsunit/harmony/regexp-property-*.js), Test262 includes tests for this feature.


OWP launch tracking bug

https://bugs.chromium.org/p/v8/issues/detail?id=4743


Entry on the feature dashboard

https://www.chromestatus.com/features/6706900393525248


Mathias Bynens

unread,
Nov 9, 2017, 4:39:07 PM11/9/17
to Mathias Bynens, blink-dev, v8-users, Yang Guo

Note that since this is a V8/JS feature, this post is just an FYI to blink-dev — no signoff from Blink API owners is required.

Adam Klein

unread,
Nov 9, 2017, 5:48:43 PM11/9/17
to Mathias Bynens, Mathias Bynens, blink-dev, v8-users, Yang Guo
LGTM (for v8 signoff purposes).

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CADizRgbnTY1wLi6ZrF4_w74-PyZSgZgUruJrP4Q6-O1i5t6aMg%40mail.gmail.com.

Mathias Bynens

unread,
Nov 14, 2017, 3:17:47 AM11/14/17
to Adam Klein, Mathias Bynens, blink-dev, v8-users, Yang Guo
For future reference: this landed in V8 v6.4.276 and should thus be available in Chrome 64.
Reply all
Reply to author
Forward
0 new messages