Skip to content

Instantly share code, notes, and snippets.

@pmatsinopoulos
Created June 26, 2023 04:48
Show Gist options
  • Save pmatsinopoulos/7e43563ba864c8867ecc688ff74e6fea to your computer and use it in GitHub Desktop.
Save pmatsinopoulos/7e43563ba864c8867ecc688ff74e6fea to your computer and use it in GitHub Desktop.
/*********************************************************************************************
* Returns a copy of "input" without the characters that exist inside the "setOfCharacters".
* It does the work in a case insensitive mode.
* Example: "Hello World!" with "setOfCharacters" being "oe", returns "Hll Wrld!".
*
* @param input
* @param setOfCharacters
* @returns String
*/
function squeeze(input, setOfCharacters) {
var re = new RegExp("[" + setOfCharacters + "]", "gi");
return input.replace(re, '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment