Match Everything But Letters and Numbers2

Match Everything But Letters and Numbers2
0.0 0

#1

Tell us what’s happening:

This is the error message

// running test
Your regex should use the global flag.
Your regex should find 6 non-alphanumeric characters in “The five boxing wizards jump quickly.”.
Your regex should find 8 non-alphanumeric characters in “Pack my box with five dozen liquor jugs.”
Your regex should find 6 non-alphanumeric characters in “How vexingly quick daft zebras jump!”
Your regex should find 12 non-alphanumeric characters in “123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.”
// tests completed

Your code so far


let quoteSample = "The five boxing wizards jump quickly.";
let nonAlphabetRegex = /\W/; // 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/67.0.3396.99 Safari/537.36.

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


#2

But there is any global flag with your pattern. Add a g at the end of pattern should pass the challenge.


#3

Look at the message on the right you are getting: “Your regex should use the global flag.”

If you are not sure what the global flag is, try looking it up in a previous lesson or a web search.