Skip to content

Instantly share code, notes, and snippets.

@luojiyin1987
Created November 4, 2021 03:37
Show Gist options
  • Save luojiyin1987/5c0146578c6e1c19b9c2b15e5f0c0997 to your computer and use it in GitHub Desktop.
Save luojiyin1987/5c0146578c6e1c19b9c2b15e5f0c0997 to your computer and use it in GitHub Desktop.
通过正则回溯 进行词的匹配
function spinalCase(str) {
return str
.split(/\s|_|(?=[A-Z])/)
.toLowerCase();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment