Skip to content

Instantly share code, notes, and snippets.

@padolsey
Last active December 18, 2015 04:49
Show Gist options
  • 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