Skip to content

Instantly share code, notes, and snippets.

@Kasahs
Last active March 1, 2016 09:03
Show Gist options
  • Save Kasahs/31a13b471b23e3f199ff to your computer and use it in GitHub Desktop.
Save Kasahs/31a13b471b23e3f199ff to your computer and use it in GitHub Desktop.
mask all but last 4 characters of a string
// source: http://stackoverflow.com/a/27545357/2317794
var str = "1238127397812378"
str = str.replace(/\d(?=\d{4})/g, "*");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment