Tell us what’s happening:
I have been trying to solve this and I have gone through the related post but I am not getting the point. I have “console.log” my result and get the desired output in the console of the editor but yet the test fails and gives the feedback “result should be equal to the string “Hello, World!” .” And my console.log provide the trimmed version of the hello message in the console the result as expected.
Your code so far
let hello = " Hello, World! ";
let wsRegex = /(^\s*)(.*)(\s*$)/; // Change this line
let result = hello.replace(wsRegex, "$2"); // Change this line
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/113.0.0.0 Safari/537.36
Challenge: Regular Expressions - Remove Whitespace from Start and End
Link to the challenge: