
If you need to strip all non-numeric characters from a string (except for the period character) using JavaScript, try:
string.replace(/[^\d.]/g, "");
This function is handy when validating input
If you need to strip all non-numeric characters from a string (except for the period character) using JavaScript, try:
string.replace(/[^\d.]/g, "");
More posts tagged:
code / javascript / Programming
More posts categorized:
asides Programming
I've trusted DreamHost to power this website – and nearly 100 other ones – since March 22, 2001. They have great prices, excellent customer support, and a killer web interface to manage your domains.