Files
test-repo/changelog_unreleased/javascript/12241.md
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
1.0 KiB
Markdown
Raw Normal View History

2022-03-16 13:25:48 +09:00
#### Add support for Unicode Set Notation in regular expressions (#12241 by @fisker)
2022-03-16 13:25:48 +09:00
The Stage 3 proposal for [Unicode Set Notation](https://github.com/tc39/proposal-regexp-set-notation/) in regular expressions is now supported via [Babel 7.17.0](https://babeljs.io/blog/2022/02/02/7.17.0).
2022-03-16 13:25:48 +09:00
See [the release blog post of Babel v7.17.0](https://babeljs.io/blog/2022/02/02/7.17.0#regexp-set-notation-and-properties-of-strings-14125httpsgithubcombabelbabelpull14125) and [the README of this proposal](https://github.com/tc39/proposal-regexp-set-notation/) for details. Also keep in mind our [policy on non-standardized syntax](https://prettier.io/docs/en/rationale.html#disclaimer-about-non-standard-syntax) before using this proposed syntax feature with Prettier.
<!-- prettier-ignore -->
```jsx
// Examples
/[\p{Decimal_Number}--[0-9]]/v; // Non-ASCII decimal digits
"Did you see the 👩🏿‍❤️‍💋‍👩🏾 emoji?".match(/\p{RGI_Emoji}/v). // ["👩🏿‍❤️‍💋‍👩🏾"]
/[\r\n\q{\r\n|NEWLINE}]/v; // Matches \r, \n, \r\n or NEWLINE
```