Skip to content

Instantly share code, notes, and snippets.

View edilsonborges's full-sized avatar
🚀

Edilson Borges edilsonborges

🚀
View GitHub Profile
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);