Files
Randell Dawson 1494a50123 fix(guide): restructure curriculum guide articles (#36501)
* fix: restructure certifications guide articles
* fix: added 3 dashes line before prob expl
* fix: added 3 dashes line before hints
* fix: added 3 dashes line before solutions
2019-07-24 13:29:27 +05:30

668 B

title
title
Match Everything But Letters and Numbers

Match Everything But Letters and Numbers


Problem Explanation

To finish this challenge, it's necessary to use character classes.

The \W matches any character that is not a word character from the basic Latin alphabet. Equivalent to [^A-Za-z0-9]._

For example, /\W/ or /[^A-Za-z0-9_]/ matches "%" in "50%".


Solutions

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