From 969b4fb274b0bb5234b8fe4199cc07dc1acb536e Mon Sep 17 00:00:00 2001 From: aksonov Date: Wed, 28 Feb 2018 10:13:44 +0100 Subject: [PATCH] use xregexp to handle unicode alphabet --- package.json | 5 ++++- validate.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b5f9e2f..578e4a9 100644 --- a/package.json +++ b/package.json @@ -40,5 +40,8 @@ "grunt-template-jasmine-istanbul": "0.4.0", "coveralls": "2.11.9" }, - "license": "MIT" + "license": "MIT", + "dependencies": { + "xregexp": "^4.1.1" + } } diff --git a/validate.js b/validate.js index 610d0bc..90f2ff5 100644 --- a/validate.js +++ b/validate.js @@ -6,6 +6,7 @@ * For all details and documentation: * http://validatejs.org/ */ + var XRegExp = require('xregexp'); (function(exports, module, define) { "use strict"; @@ -1001,7 +1002,7 @@ } if (v.isString(pattern)) { - pattern = new RegExp(options.pattern, options.flags); + pattern = XRegExp(options.pattern, options.flags); } match = pattern.exec(value); if (!match || match[0].length != value.length) {