\D* matches any character that\'s not a digit (equal to [^0-9])
* Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy
So your regex matches the entire var hello string, then you replace the whole string with a new string that does not have white space at the beginning and end. It’s not the intent of what the challenge is trying to teach so it should not pass, because you are removing the entire string (not just the white space) and replacing it with and entirely new string that does not have the white space.
You’ve looked at the hint so, in terms of learning try to understand the hint.
If you were to write a function to remove beginning and ending white space, what you have would not be a reusable function, it would only work for the specific “ Hello, World!” string. However, with the regex in the hint you could write a function that you could pass other string variables to and remove the white space.
If you want to submit the issue of your code passing, that should not, there is a way to do so on GitHub. Maybe if one of the moderators read this they can provide more specifics on it.
EDIT: I think the link for issues is here:
But check to make sure there isn’t already an open issue.