davidgagne.net

  • About
  • Archives
  • Twitter
  • Facebook
  • bartender.live
  • GitHub
  • LinkedIn

Strip Non-Numeric Characters in JavaScript

June 5th, 2012 @ 11:54 pm PDT

This function is handy when validating input

Strip Non-Numeric Characters in JavaScript

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

More posts from:
June 2012 / 2012

Post navigation

Previous Post
Previous Post Ernest Hemingway’s Standing Desk
Next Post
Next Post Tickle Me.gov

Search


Your Cocktail Companion

Your Cocktail Companion

Discover what drinks you can make from the alcohol you have at home and become a first-class mixologist with bartender.live for iOS.

  • Make Beautiful Cocktails

© David Vincent Gagne. All rights reserved. Custom WordPress Theme by Jacket Industries.