Regex

Split camelCase

mediumregexregexstring
0:00

Problem

Given a camelCase string, return an array of its lowercase component words. E.g. "camelCaseString" → ["camel", "case", "string"].

Your solution
Test results
Click Run tests to check your solution against the test cases.

About this challenge

Split camelCase is a medium regex coding challenge. It tests your command of regular expressions — pattern-matching that trips up even experienced developers. Write your solution in the editor above, run it against the test cases, and get instant feedback — free, in your browser, no sign-up.

Show a hint & approach (spoiler)

Hint: Insert a space before every uppercase letter with `s.replace(/([A-Z])/g, " $1")`, then lowercase and split on whitespace.

Keep practicing

Browse all coding challenges, or build intuition for the underlying concepts with the algorithm visualizers and the developer cheatsheets.