Use the correct String to Number conversion function:
The Number.parseFloat() method parses a string argument and returns a floating point number. This method behaves identical to the global function parseFloat and is part of ECMAScript 6 (its purpose is modularization of globals).
or
The Number.parseInt() method parses a string argument and returns an integer of the specified radix or base. This method behaves identical to the global function parseInt and is part of ECMAScript 6 (it's purpose is modularization of globals).
Know your RegEx
You should use \D
which means Any non-digit
instead of trying to do it yourself.
\[^\D\.\,\]
will match any Non-Digits and the .
or the ,
which is used outside the US for a delimiter instead of the ,
. See this link.