Ignore non-numeric characters in numbers for DataTables sort
<p>I'm creating a custom sort plugin for DataTables which will sort numeric columns which contain non-numeric rows as well. I got the part where it puts the 'N/A' rows at the bottom but cannot seem to figure out, how to make it ignore the commas in the numbers.</p>

<p>For example:</p>

<p>$12,443.00<br/>
362,123,231<br/>
N/A<br/>
N/A<br/>
null<br/>
34,242.42<br/>
23,234<br/>
null</p>

<p>The code below manages to ignore everything except for the commas in the numbers.</p>

<p>Code:</p>

<pre><code>function numeric_sort(a, b, high) {
    var reg = /[+-]?((\d+(\.\d*)?)|\.\d+)([eE][+-]?[0-9]+)?/;
    a = a.match(reg);
    a = a !== null ? parseFloat(a[0]) : high;
    b = b.match(reg);
    b = b !== null ? parseFloat(b[0]) : high;
    return ((a &lt; b) ? -1 : ((a &gt; b) ? 1 : 0));
}

jQuery.extend( jQuery.fn.dataTableExt.oSort, {
    "numeric-empty-bottom-asc": function (a, b) {
        return numeric_sort(a, b, Number.POSITIVE_INFINITY);
    },
    "numeric-empty-bottom-desc": function (a, b) {
        return numeric_sort(a, b, Number.NEGATIVE_INFINITY) * -1;
    }
} );
</code></pre>

<p>I got the code from: <a href="http://jsfiddle.net/6qmkY/" rel="nofollow">http://jsfiddle.net/6qmkY/</a></p>

<p>Any help will be appreciated. </p>