What is @babel/plugin-syntax-unicode-sets-regex?
The @babel/plugin-syntax-unicode-sets-regex package allows Babel to parse regular expressions that use the Unicode property escapes syntax within character classes. This is part of the ECMAScript 2021 specification. The plugin itself does not transform these regular expressions; it only enables Babel to understand them during the parsing phase, which is useful when working with next-generation JavaScript features.
Parsing Unicode property escapes in regex
This feature allows Babel to parse regular expressions that include Unicode property escapes, such as matching characters of a specific script like Hiragana. The 'u' flag is necessary for these expressions.
/\p{Script=Hiragana}+/u