-
-
Save MelMacaluso/a57ebc8a5ac1f4c5df45b705ffb22ffa to your computer and use it in GitHub Desktop.
Convert text to a valid CSS class name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string = 'Invalid C$$ class name'; | |
// Actually delete the spaces too... | |
string.replace(/[!\"#$%&'\(\)\*\+,\.\/:;<=>\?\@\[\\\]\^`\{\|\}|\s~]/g, '').toLowerCase(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment