Match All Non-Numbers - not working properly?

Tell us what’s happening:
Hello everyone! I was not able to complete this challenge until I use [\D] with square brackets as to without. From what I have understood via tutorial, brackets should not be needed - \D = [^0-9]. Can someone explain me what is it that I am getting wrong?

Your code so far


let numString = "Your sandwich will be $5.00";
let noNumRegex = /[\D]/gi; // Change this line
let result = numString.match(noNumRegex).length;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-all-non-numbers

I just removed the brackets and it passes the test in the same way.

That’s interesting…I can’t get it to work that way. Thanks for trying though!