Skip to content

Instantly share code, notes, and snippets.

@padolsey
Last active December 18, 2015 04:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save padolsey/5727759 to your computer and use it in GitHub Desktop.
Save padolsey/5727759 to your computer and use it in GitHub Desktop.
function f(a, b) {
return (
a.match(
RegExp('[' + b.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1') + ']', 'g')
) || []
).join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment