Skip to content

Instantly share code, notes, and snippets.

@pom421
Last active April 17, 2017 14:20
Show Gist options
  • Save pom421/05ff1e911ca3538a4dfce3a6f6e90f17 to your computer and use it in GitHub Desktop.
Save pom421/05ff1e911ca3538a4dfce3a6f6e90f17 to your computer and use it in GitHub Desktop.
Référence : https://www.codewars.com/kata/please-help-bob/javascript
Exemples :
"Hello, I am Mr Bob" --> "Hello, I amerr Mrerr Boberr"
"THIS IS CRAZY!" --> "THISERR ISERR CRAZYERR!"
const errBob = string =>
string
.replace(/([bcdfghjklmnpqrstvwxyz])(\W|$)/g, '$1err$2')
.replace(/([BCDFGHJKLMNPQRSTVWXYZ])(\W|$)/g, '$1ERR$2');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment