Skip to content

Instantly share code, notes, and snippets.

@Lukas238
Forked from Axighi/increase_replace.js
Created October 2, 2019 04:57
Show Gist options
  • Save Lukas238/0eb2a729a75470a61202a3926374d9d6 to your computer and use it in GitHub Desktop.
Save Lukas238/0eb2a729a75470a61202a3926374d9d6 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