Remove Whitespace from Start and End0

Tell us what’s happening:

Only this test case fails. Please help me out. Thanks in advance.
result should equal to "Hello, World!"

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end

Exclude the word “Hello, World!” from the regex.

Hint: negative lookahead

This means you are looking for a string that starts with a whitespace character and ends with a whitespace character with nothing else allowed in between. Is this what you were trying to say with your regex?

Also, this might be useful to you if you are trying to replace something that occurs more than once in your string. From the description:

To perform a global search and replace, include the g switch in the regular expression.