@babel/plugin-proposal-unicode-property-regex

Here’s an online demo.

Installation

  1. npm install --save-dev @babel/plugin-proposal-unicode-property-regex

Usage

  1. {
  2. "plugins": ["@babel/plugin-proposal-unicode-property-regex"]
  3. }

Via CLI

  1. babel --plugins @babel/@babel/plugin-proposal-unicode-property-regex script.js

Via Node.js API

  1. require("@babel/core").transform(code, {
  2. "plugins": ["@babel/plugin-proposal-unicode-property-regex"]
  3. });

To transpile to ES6/ES2015:

  1. require("@babel/core").transform(code, {
  2. "plugins": [
  3. ["@babel/plugin-proposal-unicode-property-regex", { "useUnicodeFlag": false }]
  4. ]
  5. });

Options

  • useUnicodeFlag (defaults to true)

When disabled with false, the transform converts Unicode regexes tonon-Unicode regexes for wider support, removing the u flag. See https://github.com/mathiasbynens/regexpu-core#useunicodeflag-default-false for more information.

You can read more about configuring plugin options here

Author

twitter/mathias
Mathias Bynens