Skip to content

Instantly share code, notes, and snippets.

@elclanrs
Last active December 16, 2015 22:20
Show Gist options
  • Save elclanrs/5506663 to your computer and use it in GitHub Desktop.
Save elclanrs/5506663 to your computer and use it in GitHub Desktop.
/**
* String.prototype.gmatch
*/
String.prototype.gmatch = function(regex) {
var result = [];
this.replace(regex, function() {
var matches = [].slice.call(arguments, 1, -2);
result.push.apply(result, matches);
});
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment