Skip to content

Instantly share code, notes, and snippets.

@eduardorangell
Created April 4, 2022 21:51
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 eduardorangell/59d2a9d2a0d4c627adfd65d4f4944446 to your computer and use it in GitHub Desktop.
Save eduardorangell/59d2a9d2a0d4c627adfd65d4f4944446 to your computer and use it in GitHub Desktop.
Regex para formatar CPF
const cpf = "1234567890";
console.log(cpf.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, '$1.$2.$3-$4'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment