Skip to content

Instantly share code, notes, and snippets.

@alexandreservian
Created January 30, 2020 16:41
Show Gist options
  • Save alexandreservian/180c7a25a5443b0d4f1440973f9c1987 to your computer and use it in GitHub Desktop.
Save alexandreservian/180c7a25a5443b0d4f1440973f9c1987 to your computer and use it in GitHub Desktop.
Método replace manipulando grupos
const text = "2019-26-09";
const regex = /(\d{4})-(\d{2})-(\d{2})/g;
console.log(text.replace(regex, "$2/$3/$1"));
// 26/09/2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment