better-replace
v1.0.2
Published
Use regular expressions to replace things in strings!
Downloads
66
Maintainers
Readme
better-replace
- No need to remember to add
g
every time - Less junk passed to the replacer function
npm i better-replace
betterReplace(
/'(\w)/,
char => `'${char}${char}${char}`,
`How's it going y'all? What's the haps`
) // => `How'sss it going y'aaall? What'sss the haps`
betterReplace(
/(\d):(\d)/g,
(first, second) => `${second}-${first}`,
'1:2 3:4'
) // => '2-1 4-3'