Link Search Menu Expand Document

Match Everything But Letters and Numbers

Summary

  • \W searches for everything that is not a letter or number.

Final Code

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