Skip to content

Instantly share code, notes, and snippets.

@ssut
Forked from hao-ji-xing/douhao.js
Created November 17, 2013 09:26
Show Gist options
  • Save ssut/7511228 to your computer and use it in GitHub Desktop.
Save ssut/7511228 to your computer and use it in GitHub Desktop.
'3423112'.replace(/\d(?=(?:\d{3})+$)/g,'$&,')
"3,423,112"
'3423112'.replace(/(?!^)(?=(?:\d{3})+$)/g,',')
"3,423,112"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment