[CLOSED]Hello everyone, i think that my code is enough to pass the test but it is not, please help me to find what is wrong here! Thank you

Tell us what’s happening:

Your code so far

let hello = "   Hello, World!  ";
let wsRegex = /^(\s+)(.*)(\s+)$/gi; // Change this line
let result = hello.replace(wsRegex,"$2"); // Change this line

Your browser information:

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

Challenge: Remove Whitespace from Start and End

Link to the challenge:

your result is equal to 'Hello, World! '
I think because the * is greedy. So maybe with lazy matching…

1 Like

thank you i got it :smiling_face_with_three_hearts: