Skip to content

Instantly share code, notes, and snippets.

@edilsonborges
Created March 23, 2017 10:22
Show Gist options
  • Save edilsonborges/9f7f0e62ceb5b541a0690df3a8cd0d46 to your computer and use it in GitHub Desktop.
Save edilsonborges/9f7f0e62ceb5b541a0690df3a8cd0d46 to your computer and use it in GitHub Desktop.
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