@babel/plugin-syntax-unicode-sets-regex
note
Syntax only
It's unlikely you want to use this plugin directly as it only enables Babel to parse this syntax. Instead, use plugin-transform-unicode-sets-regex to both parse and transform this syntax.
This plugin enables parsing regular expressions using the v
flag, introduced by the RegExp set notation + properties of strings proposal, to regular expressions that use the u
flag.
Example
JavaScript
/[\p{ASCII}&&\p{Decimal_Number}]/v
Installation
- npm
- Yarn
- pnpm
npm install --save-dev @babel/plugin-syntax-unicode-sets-regex
yarn add --dev @babel/plugin-syntax-unicode-sets-regex
pnpm add --save-dev @babel/plugin-syntax-unicode-sets-regex
Usage
With a configuration file (Recommended)
babel.config.json
{
"plugins": ["@babel/plugin-syntax-unicode-sets-regex"]
}
Via CLI
Shell
babel --plugins @babel/plugin-syntax-unicode-sets-regex script.js
Via Node API
JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-syntax-unicode-sets-regex"],
});