Created
March 23, 2017 10:22
-
-
Save edilsonborges/9f7f0e62ceb5b541a0690df3a8cd0d46 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const regex = /([$][a-z]*)[_]([a-z])([a-z]*)/g; | |
const str = `\$bo_ativo`; | |
const subst = `$1\U$2\E$3`; | |
// The substituted value will be contained in the result variable | |
const result = str.replace(regex, subst); | |
console.log('Substitution result: ', result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment