Skip to content

Instantly share code, notes, and snippets.

@lancevo
Last active November 1, 2018 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lancevo/59b0ebda58f15cc3bff6890496bd9251 to your computer and use it in GitHub Desktop.
Save lancevo/59b0ebda58f15cc3bff6890496bd9251 to your computer and use it in GitHub Desktop.
Some of the common regex patterns
// Separate numbers to a group of 3 and add a comma
'123456'.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); // output: 123,456
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment