mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Support octets with a single digit in ipAddress parser
This commit is contained in:
parent
08ff6e2097
commit
660fde6683
@ -1026,7 +1026,7 @@
|
||||
ts.addParser({
|
||||
id: "ipAddress",
|
||||
is: function(s) {
|
||||
return (/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/).test(s);
|
||||
return (/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/).test(s);
|
||||
},
|
||||
format: function(s, table) {
|
||||
var i, item, a = s.split("."),
|
||||
@ -1034,7 +1034,9 @@
|
||||
l = a.length;
|
||||
for (i = 0; i < l; i++) {
|
||||
item = a[i];
|
||||
if (item.length === 2) {
|
||||
if (item.length === 1) {
|
||||
r += "00" + item;
|
||||
} else if (item.length === 2) {
|
||||
r += "0" + item;
|
||||
} else {
|
||||
r += item;
|
||||
|
Loading…
Reference in New Issue
Block a user