What went wrong? Am I just matching and not removing anything? I don’t know if the proper method is being used but I decided to go with match(). Thanks!
let hello = " Hello, World! ";
let wsRegex = /$\s+\w+\s+$/; // Change this line
let result = hello.match(wsRegex); // Change this line
console.log(hello)
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.105 Safari/537.36.
Wrote a funny solution, but with the hope that you will improve it:
let hello = " Hello, World! ";
let wsRegex = /H.*!/; // Improve this line!! Don't be lazy!
let result = hello.match(wsRegex);
console.log("hi", result, "hi")
So I completed it! I just consoled the result as you said and it showed me what the string looked like live and I just inserted the proper characters. Here was the solution:
let hello = " Hello, World! ";
let wsRegex = /\S*\w+.\s\w+./; // Change this line
let result = hello.match(wsRegex); // Change this line
console.log(result)