Regular Expressions - Use Capture Groups to Search and Replace

Describe your issue in detail here.
I have the correct code but tests won’t pass.
I checked it against the correct code and my code seems OK
Thanks for any help :slight_smile:

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36

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

Link to the challenge:

Only one of your three capture groups is correct. The other two do not use the correct syntax to capture one or more word characters.