Whitespace from Start and End

Hello Guys Iam trying to Remove the WhiteSpaces “start and End of a string” this is my code.

note its still failing

let hello = "   Hello, World!  ";

let wsRegex = /(^[\s+$]*)/g; // Change this line

let result = hello.replace(/(^[\s+$]*)/,''); // Change this line

Any TIP? Thank you

I suppose you’re specifically asked not to use .trim(), right?

This is incorrect regex. You can check how it works here:

Same website might help with debugging :wink:

Thank you i will check it out!