Skip to content

Instantly share code, notes, and snippets.

@Axighi
Created May 2, 2017 08:45
Show Gist options
  • Save Axighi/d7300d279c6e5fc9b23d1f90c7cdac48 to your computer and use it in GitHub Desktop.
Save Axighi/d7300d279c6e5fc9b23d1f90c7cdac48 to your computer and use it in GitHub Desktop.
Using regex to replace match strings with auto increment number.
'An aplle is not a banana'.replace(/a/g, (() => {
var number = 0;
return () => {
return number++;
}
})())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment