Skip to content

Instantly share code, notes, and snippets.

@AWaselnuk
Created December 5, 2014 20:02
Show Gist options
  • Save AWaselnuk/72ee50d93a7c8d9589a1 to your computer and use it in GitHub Desktop.
Save AWaselnuk/72ee50d93a7c8d9589a1 to your computer and use it in GitHub Desktop.
Make a string safe for css (by removing all nonalphanumeric characters)
var str = 'A&P Grocers, Inc.';
str.replace(/\W/g, '').toLowerCase(); // apgrocersinc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment