Skip to content

Instantly share code, notes, and snippets.

@dperrymorrow
Created March 14, 2012 18:55
Show Gist options
  • Save dperrymorrow/2038646 to your computer and use it in GitHub Desktop.
Save dperrymorrow/2038646 to your computer and use it in GitHub Desktop.
regex to put commas in a dollar amount
number.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment