Regular Expressions 101

Community Patterns

Detect start of words to then convert string to camelCase, kebab-case, snake_case, etc.

0

Regular Expression
ECMAScript (JavaScript)

/
(?:^| )([a-zA-Z0-9])
/
gm

Description

You can use this to match the first character in each word. Use a function to then iterate over the matches to transform into the various cases.

Submitted by Matt Scheurich - a year ago