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); |