Skip to main content

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

This plugin transforms 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

will be transformed to

JavaScript
/[0-9]/u

Installation

npm install --save-dev @babel/plugin-proposal-unicode-sets-regex

Usage

babel.config.json
{
"plugins": ["@babel/plugin-proposal-unicode-sets-regex"]
}

Via CLI

Shell
babel --plugins @babel/plugin-proposal-unicode-sets-regex script.js

Via Node API

JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-proposal-unicode-sets-regex"],
});