Skip to content

Instantly share code, notes, and snippets.

@defbyte
Created August 8, 2011 16:53
Show Gist options
  • Save defbyte/1132172 to your computer and use it in GitHub Desktop.
Save defbyte/1132172 to your computer and use it in GitHub Desktop.
String.slugify
// Add "slugify" method to String
String.prototype.slugify = function(){
return this.replace(/\s+/g,'-').replace(/[^a-zA-Z0-9\-]/g,'').toLowerCase();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment