← All Exercises
Python Regex Substitution
intermediatepython
Background
Regex substitution is powerful for text transformation, used in code refactoring, template processing, and data cleaning.
Problem
Write a function that takes a string and converts all kebab-case words (hyphen-separated) to camelCase using regex substitution.
Input
A string containing kebab-case words.
Output
A string with kebab-case words converted to camelCase.
Sample tests
Sample 1
Input: "hello-world foo-bar-baz"
Expected: "helloWorld fooBarBaz"
Your solution
Learning objective
Learn regex substitution with function replacements and capture group processing.