Having trouble solving Match All Letters and Numbers

Hi guys, what did you do to pass this test?
I read the MDN Regex documentation above and still unable to solve this problem. Below is my code:

let quoteSample = "The five boxing wizards jump quickly.";
//let quoteSample = "Pack my box with five dozen liquor jugs.";
let alphabetRegexV2 = /\w+/gi; // Change this line
let result = quoteSample.match(alphabetRegexV2).length;

And here is the errors I’ve got:
// running test
Your regex should find 31 alphanumeric characters in “The five boxing wizards jump quickly.”
Your regex should find 32 alphanumeric characters in “Pack my box with five dozen liquor jugs.”
Your regex should find 30 alphanumeric characters in “How vexingly quick daft zebras jump!”
Your regex should find 36 alphanumeric characters in “123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.”
// tests completed

Any suggestion is appreciated. Thanks a bunch guys.

2 Likes

Thank you for the hint. I keep thinking + means in case the character repeats itself, the search still counts the repeated character towards the result. Does it mean + only counts when a character repeats itself, like “aa” is counted but “a” is not? And that’s why my above code did not work?
I simply removed + and the beloved popup showed up.

Ah, thank you for your explanation.

1 Like