Fix: Natural sorting - numbers with percentage signs to be sorted numerically

- Fixes 298
pull/301/head
Allan Jardine 8 years ago
parent e364a8156d
commit b76ace2d2e

@ -38,7 +38,7 @@
* See: http://js-naturalsort.googlecode.com/svn/trunk/naturalSort.js * See: http://js-naturalsort.googlecode.com/svn/trunk/naturalSort.js
*/ */
function naturalSort (a, b, html) { function naturalSort (a, b, html) {
var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi, var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?%?$|^0x[0-9a-f]+$|[0-9]+)/gi,
sre = /(^[ ]*|[ ]*$)/g, sre = /(^[ ]*|[ ]*$)/g,
dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
hre = /^0x[0-9a-f]+$/i, hre = /^0x[0-9a-f]+$/i,

Loading…
Cancel
Save