Skip to content

Instantly share code, notes, and snippets.

@buithehoa
Created November 8, 2015 14:44
Show Gist options
  • Save buithehoa/97143369a9f652fa739d to your computer and use it in GitHub Desktop.
Save buithehoa/97143369a9f652fa739d to your computer and use it in GitHub Desktop.
Replace all non-alphanumeric characters
"foo bar".downcase.gsub(/[^\p{Alnum}]/, '-') # Output: foo-bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment