Browse Source

Fix unicode categories

Robin Herbots 2 years ago
parent
commit
e6666f0970
2 changed files with 2 additions and 1 deletions
  1. 1 0
      Changelog.md
  2. 1 1
      lib/mask-lexer.js

+ 1 - 0
Changelog.md

@@ -9,6 +9,7 @@
 - Properly handle insertMode false in alternation logic.
 
 ### Fixed
+- Unicode categories such as \p{P} or \p{S} does not work in regexp property #2741
 - When user press Ctrl+Alt / Alt+Ctrl key in the field, Can input characters with restricted formatting #2736
 - The leap year doesn't play well with jitMasking parameter #2647
 - dd.mm.yyyy can't enter a day greater than the 9 #2723

+ 1 - 1
lib/mask-lexer.js

@@ -135,7 +135,7 @@ function analyseMask(mask, regexMask, opts) {
         if (regexMask) {
             if (element.indexOf("[") === 0 || (escaped && /\\d|\\s|\\w|\\p/i.test(element)) || element === ".") {
                 let flag = opts.casing ? "i" : "";
-                if (/^\\p\{.*}$/i.test(element))
+                if (/\\p\{.*}/i.test(element))
                     flag += "u";
                 mtoken.matches.splice(position++, 0, {
                     fn: new RegExp(element, flag),