Skip to content

Instantly share code, notes, and snippets.

@rtivital
Last active December 12, 2015 21:17
Show Gist options
  • Save rtivital/62539a819cbb3bfadcaa to your computer and use it in GitHub Desktop.
Save rtivital/62539a819cbb3bfadcaa to your computer and use it in GitHub Desktop.
function escapeRegExp(str) {
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
function removeLetters(str, letters) {
return str.replace(new RegExp(escapeRegExp(letters), 'g'), '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment