Regular Expressions - Use Capture Groups to Search and Replace

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

let str = "one two three";
let fixRegex = str.replace(/(\w+) \s(\w+)/); // Change this line
let replaceText = "/($3 $2 $1)/"; // Change this line
let result = str.replace(fixRegex, replaceText);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge: Regular Expressions - Use Capture Groups to Search and Replace

Link to the challenge:

Hi, did you have a question or error message?

1 Like

Welcome to FCC Forum!
Please tell us what the problem is in your own words. Learning to describe problems is hard, but it is an important part of learning how to code.
Also, the more you say, the more we can help!