1 of 12

Sequence properties in Unicode property escapes

2 of 12

3 of 12

4 of 12

5 of 12

const reGreekSymbol = /\p{Script_Extensions=Greek}/u;�reGreekSymbol.test('π');// → true

6 of 12

const re = /\p{RGI_Emoji_ZWJ_Sequence}/u;re.test('👨🏾‍⚕️'); // '\u{1F468}\u{1F3FE}\u200D\u2695\uFE0F'// → true

7 of 12

const reBasicEmoji = /\p{Basic_Emoji}/u;reBasicEmoji.test('⌚'); // '\u231A'

// → true

reBasicEmoji.test('⏲️'); // '\u23F2\uFE0F'// → true

8 of 12

// mental model for developers:

\p{Foo}

refers to the Unicode property Foo

9 of 12

\p{Foo}

refers to the Unicode

non-sequence property Foo

// alternative mental model:

\q{Bar}

refers to the Unicode

sequence property Bar

10 of 12

// Unified syntax with \p{…}

\p{Emoji} // works

\P{Emoji} // works

[\p{Emoji}] // works

[^\p{Emoji}] // works

\p{RGI_Emoji_ZWJ_Sequence} // works

\P{RGI_Emoji_ZWJ_Sequence} // throws an exception

[\p{RGI_Emoji_ZWJ_Sequence}] // throws an exception

[^\p{RGI_Emoji_ZWJ_Sequence}] // throws an exception

\p{InVaLiD} // throws an exception

\P{InVaLiD} // throws an exception

11 of 12

// Disunified syntax with \p{…} and \q{…}

\p{Emoji} // works

\P{Emoji} // works

[\p{Emoji}] // works

[^\p{Emoji}] // works

\q{Emoji} // throws an exception

[\q{Emoji}] // throws an exception

[^\q{Emoji}] // throws an exception

\p{RGI_Emoji_ZWJ_Sequence} // throws an exception

\P{RGI_Emoji_ZWJ_Sequence} // throws an exception

\q{RGI_Emoji_ZWJ_Sequence} // works

\Q{RGI_Emoji_ZWJ_Sequence} // throws an exception

[\p{RGI_Emoji_ZWJ_Sequence}] // throws an exception

[^\p{RGI_Emoji_ZWJ_Sequence}] // throws an exception

[\q{RGI_Emoji_ZWJ_Sequence}] // throws an exception

[^\q{RGI_Emoji_ZWJ_Sequence}] // throws an exception

\p{InVaLiD} // throws an exception

\P{InVaLiD} // throws an exception

\q{InVaLiD} // throws an exception

\Q{InVaLiD} // throws an exception

12 of 12

Unified or disunified?