|
@@ -3,7 +3,7 @@
|
|
|
* http://github.com/RobinHerbots/jquery.inputmask
|
|
* http://github.com/RobinHerbots/jquery.inputmask
|
|
|
* Copyright (c) 2010 - 2013 Robin Herbots
|
|
* Copyright (c) 2010 - 2013 Robin Herbots
|
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-* Version: 2.3.20
|
|
|
|
|
|
|
+* Version: 2.3.22
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
(function ($) {
|
|
(function ($) {
|
|
@@ -335,13 +335,13 @@
|
|
|
if (openenings.length > 0) {
|
|
if (openenings.length > 0) {
|
|
|
openenings[openenings.length - 1]["matches"].push(openingToken);
|
|
openenings[openenings.length - 1]["matches"].push(openingToken);
|
|
|
} else {
|
|
} else {
|
|
|
- currentToken = new maskToken();
|
|
|
|
|
maskTokens.push(openingToken);
|
|
maskTokens.push(openingToken);
|
|
|
|
|
+ currentToken = new maskToken();
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case opts.optionalmarker.start:
|
|
case opts.optionalmarker.start:
|
|
|
// optional opening
|
|
// optional opening
|
|
|
- if (currentToken.matches.length > 0)
|
|
|
|
|
|
|
+ if (!currentToken.isGroup && currentToken.matches.length > 0)
|
|
|
maskTokens.push(currentToken);
|
|
maskTokens.push(currentToken);
|
|
|
currentToken = new maskToken();
|
|
currentToken = new maskToken();
|
|
|
currentToken.isOptional = true;
|
|
currentToken.isOptional = true;
|
|
@@ -349,7 +349,7 @@
|
|
|
break;
|
|
break;
|
|
|
case opts.groupmarker.start:
|
|
case opts.groupmarker.start:
|
|
|
// Group opening
|
|
// Group opening
|
|
|
- if (currentToken.matches.length > 0)
|
|
|
|
|
|
|
+ if (!currentToken.isGroup && currentToken.matches.length > 0)
|
|
|
maskTokens.push(currentToken);
|
|
maskTokens.push(currentToken);
|
|
|
currentToken = new maskToken();
|
|
currentToken = new maskToken();
|
|
|
currentToken.isGroup = true;
|
|
currentToken.isGroup = true;
|
|
@@ -364,8 +364,6 @@
|
|
|
openenings[openenings.length - 1]["matches"].push(quantifier);
|
|
openenings[openenings.length - 1]["matches"].push(quantifier);
|
|
|
} else {
|
|
} else {
|
|
|
currentToken.matches.push(quantifier);
|
|
currentToken.matches.push(quantifier);
|
|
|
- maskTokens.push(currentToken);
|
|
|
|
|
- currentToken = new maskToken();
|
|
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
@@ -376,6 +374,7 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (currentToken.matches.length > 0)
|
|
if (currentToken.matches.length > 0)
|
|
|
maskTokens.push(currentToken);
|
|
maskTokens.push(currentToken);
|
|
|
|
|
|
|
@@ -1560,7 +1559,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2013 Robin Herbots
|
|
Copyright (c) 2010 - 2013 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 2.3.20
|
|
|
|
|
|
|
+Version: 2.3.22
|
|
|
|
|
|
|
|
Optional extensions on the jquery.inputmask base
|
|
Optional extensions on the jquery.inputmask base
|
|
|
*/
|
|
*/
|
|
@@ -1662,7 +1661,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2012 Robin Herbots
|
|
Copyright (c) 2010 - 2012 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 2.3.20
|
|
|
|
|
|
|
+Version: 2.3.22
|
|
|
|
|
|
|
|
Optional extensions on the jquery.inputmask base
|
|
Optional extensions on the jquery.inputmask base
|
|
|
*/
|
|
*/
|
|
@@ -2139,7 +2138,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2013 Robin Herbots
|
|
Copyright (c) 2010 - 2013 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 2.3.20
|
|
|
|
|
|
|
+Version: 2.3.22
|
|
|
|
|
|
|
|
Optional extensions on the jquery.inputmask base
|
|
Optional extensions on the jquery.inputmask base
|
|
|
*/
|
|
*/
|
|
@@ -2308,7 +2307,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2013 Robin Herbots
|
|
Copyright (c) 2010 - 2013 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 2.3.20
|
|
|
|
|
|
|
+Version: 2.3.22
|
|
|
|
|
|
|
|
Regex extensions on the jquery.inputmask base
|
|
Regex extensions on the jquery.inputmask base
|
|
|
Allows for using regular expressions as a mask
|
|
Allows for using regular expressions as a mask
|
|
@@ -2331,6 +2330,7 @@ Allows for using regular expressions as a mask
|
|
|
this.matches = [];
|
|
this.matches = [];
|
|
|
this.isGroup = false;
|
|
this.isGroup = false;
|
|
|
this.isQuantifier = false;
|
|
this.isQuantifier = false;
|
|
|
|
|
+ this.isLiteral = false;
|
|
|
}
|
|
}
|
|
|
function analyseRegex() {
|
|
function analyseRegex() {
|
|
|
var currentToken = new regexToken(), match, m, opengroups = [];
|
|
var currentToken = new regexToken(), match, m, opengroups = [];
|
|
@@ -2343,10 +2343,6 @@ Allows for using regular expressions as a mask
|
|
|
switch (m.charAt(0)) {
|
|
switch (m.charAt(0)) {
|
|
|
case "[": // Character class
|
|
case "[": // Character class
|
|
|
case "\\": // Escape or backreference
|
|
case "\\": // Escape or backreference
|
|
|
- if (currentToken["isGroup"] !== true) {
|
|
|
|
|
- currentToken = new regexToken();
|
|
|
|
|
- opts.regexTokens.push(currentToken);
|
|
|
|
|
- }
|
|
|
|
|
if (opengroups.length > 0) {
|
|
if (opengroups.length > 0) {
|
|
|
opengroups[opengroups.length - 1]["matches"].push(m);
|
|
opengroups[opengroups.length - 1]["matches"].push(m);
|
|
|
} else {
|
|
} else {
|
|
@@ -2354,6 +2350,8 @@ Allows for using regular expressions as a mask
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case "(": // Group opening
|
|
case "(": // Group opening
|
|
|
|
|
+ if (!currentToken.isGroup && currentToken.matches.length > 0)
|
|
|
|
|
+ opts.regexTokens.push(currentToken);
|
|
|
currentToken = new regexToken();
|
|
currentToken = new regexToken();
|
|
|
currentToken.isGroup = true;
|
|
currentToken.isGroup = true;
|
|
|
opengroups.push(currentToken);
|
|
opengroups.push(currentToken);
|
|
@@ -2365,7 +2363,6 @@ Allows for using regular expressions as a mask
|
|
|
} else {
|
|
} else {
|
|
|
opts.regexTokens.push(groupToken);
|
|
opts.regexTokens.push(groupToken);
|
|
|
currentToken = new regexToken();
|
|
currentToken = new regexToken();
|
|
|
- opts.regexTokens.push(currentToken);
|
|
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case "{": //Quantifier
|
|
case "{": //Quantifier
|
|
@@ -2383,13 +2380,19 @@ Allows for using regular expressions as a mask
|
|
|
// ^ or $ anchor
|
|
// ^ or $ anchor
|
|
|
// Dot (.)
|
|
// Dot (.)
|
|
|
// Literal character sequence
|
|
// Literal character sequence
|
|
|
|
|
+ var literal = new regexToken();
|
|
|
|
|
+ literal.isLiteral = true;
|
|
|
|
|
+ literal.matches.push(m);
|
|
|
if (opengroups.length > 0) {
|
|
if (opengroups.length > 0) {
|
|
|
- opengroups[opengroups.length - 1]["matches"].push(m);
|
|
|
|
|
|
|
+ opengroups[opengroups.length - 1]["matches"].push(literal);
|
|
|
} else {
|
|
} else {
|
|
|
- currentToken.matches.push(m);
|
|
|
|
|
|
|
+ currentToken.matches.push(literal);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (currentToken.matches.length > 0)
|
|
|
|
|
+ opts.regexTokens.push(currentToken);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
function validateRegexToken(token, fromGroup) {
|
|
function validateRegexToken(token, fromGroup) {
|
|
@@ -2412,8 +2415,21 @@ Allows for using regular expressions as a mask
|
|
|
var exp = new RegExp("^(" + testExp + ")$");
|
|
var exp = new RegExp("^(" + testExp + ")$");
|
|
|
isvalid = exp.test(bufferStr);
|
|
isvalid = exp.test(bufferStr);
|
|
|
regexPart += matchToken;
|
|
regexPart += matchToken;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else if (matchToken["isLiteral"] == true) {
|
|
|
|
|
+ matchToken = matchToken["matches"][0];
|
|
|
|
|
+ var testExp = regexPart, openGroupCloser = "";
|
|
|
|
|
+ for (var j = 0; j < openGroupCount; j++) {
|
|
|
|
|
+ openGroupCloser += ")";
|
|
|
|
|
+ }
|
|
|
|
|
+ for (var k = 0; k < matchToken.length; k++) { //relax literal validation
|
|
|
|
|
+ testExp = (testExp + matchToken[k]).replace(/\|$/, "");
|
|
|
|
|
+ var exp = new RegExp("^(" + testExp + openGroupCloser + ")$");
|
|
|
|
|
+ isvalid = exp.test(bufferStr);
|
|
|
|
|
+ if (isvalid) break;
|
|
|
|
|
+ }
|
|
|
|
|
+ regexPart += matchToken;
|
|
|
|
|
+ console.log(bufferStr + " " + exp + " " + isvalid);
|
|
|
|
|
+ } else {
|
|
|
regexPart += matchToken;
|
|
regexPart += matchToken;
|
|
|
var testExp = regexPart.replace(/\|$/, "");
|
|
var testExp = regexPart.replace(/\|$/, "");
|
|
|
for (var j = 0; j < openGroupCount; j++) {
|
|
for (var j = 0; j < openGroupCount; j++) {
|
|
@@ -2421,7 +2437,7 @@ Allows for using regular expressions as a mask
|
|
|
}
|
|
}
|
|
|
var exp = new RegExp("^(" + testExp + ")$");
|
|
var exp = new RegExp("^(" + testExp + ")$");
|
|
|
isvalid = exp.test(bufferStr);
|
|
isvalid = exp.test(bufferStr);
|
|
|
- //console.log(bufferStr + " " + exp + " " + isvalid);
|
|
|
|
|
|
|
+ console.log(bufferStr + " " + exp + " " + isvalid);
|
|
|
}
|
|
}
|
|
|
if (isvalid) break;
|
|
if (isvalid) break;
|
|
|
}
|
|
}
|