Match Everything But Letters and Numbers, please clarify the use of /W

Can someone tell me what’s happening here, this code returns 6 in the console. I thought it should be returning 1 because ‘.’ is the only non-alphanumeric here. please clarify…

Your code so far


let quoteSample = "The five boxing wizards jump quickly.";
let nonAlphabetRegex = /\W/g; // Change this line
let result = quoteSample.match(nonAlphabetRegex).length;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

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

space is :slight_smile:

Just to elaborate more, \W covers 1. non Latin letters(case insensitive), 2. non digits, 3. non underscore. That is it, it matches all the other characters, including space, dot etc.

Oh yeah :grin: thank you brother