Skip to content

Instantly share code, notes, and snippets.

@ValchanOficial
Last active March 18, 2024 15:11
Show Gist options
  • Save ValchanOficial/e34d3ff1bb5bf7b44577fbc681661dac to your computer and use it in GitHub Desktop.
Save ValchanOficial/e34d3ff1bb5bf7b44577fbc681661dac to your computer and use it in GitHub Desktop.
[Javascript] replaceAt and regex matches between symbol
// https://stackoverflow.com/a/1431113/11842937
const replaceAt = function(str, index, replacement) {
return str.substring(0, index) + replacement + str.substring(index + replacement.length);
}
https://regexr.com/ - regex matches between symbol
regex = new RegExp(`^\\${symbol}(.*)\\${symbol}$`, 'gm')
g = global
m = multiline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment