Consider a non-DOM scenario where you\'d want to remove all non-numeric characters from a string using JavaScript/ECMAScript. Any characters that are in range 0 - 9
0 - 9
You can use a RegExp to replace all the non-digit characters:
var myString = 'abc123.8'; myString = myString.replace(/[^\d]/g, ''); // 1238