Numbers with percent signs get treated as text. This works OK if they're all positive (or all negative) but breaks when there's a mix of positive & negative values. A two character change to the number regex fixes the issue:
@@ -70,7 +70,7 @@
* See: http://js-naturalsort.googlecode.com/svn/trunk/naturalSort.js
*/
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,
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,
Numbers with percent signs get treated as text. This works OK if they're all positive (or all negative) but breaks when there's a mix of positive & negative values. A two character change to the number regex fixes the issue: