Last active
March 18, 2024 15:11
-
-
Save ValchanOficial/e34d3ff1bb5bf7b44577fbc681661dac to your computer and use it in GitHub Desktop.
[Javascript] replaceAt and regex matches between symbol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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