0 - 9 should be kept.
var myString = 'abc123.8<blah>'; //desired output is 1238
Use the string’s
.replace method with a regex of
\D, which is a shorthand character class that matches all non-digits:
myString = myString.replace(/\D/g,'');
Answered By – csj
Answer Checked By – Willingham (BugsFixing Volunteer)