2018-10-04 13:47:55 +00:00
|
|
|
---
|
|
|
|
title: Match All Letters and Numbers
|
|
|
|
---
|
2018-11-13 07:24:33 +00:00
|
|
|
## The Problem
|
2018-10-04 13:47:55 +00:00
|
|
|
|
2018-11-13 07:24:33 +00:00
|
|
|
Use the shorthand character class \w to count the number of alphanumeric characters in various quotes and strings.
|
2018-10-04 13:47:55 +00:00
|
|
|
|
|
|
|
|
2018-11-13 07:24:33 +00:00
|
|
|
## Solution
|
2018-10-04 13:47:55 +00:00
|
|
|
|
2018-11-13 07:24:33 +00:00
|
|
|
```let quoteSample = "The five boxing wizards jump quickly.";
|
|
|
|
let alphabetRegexV2 = /\w/gi; // Change this line
|
|
|
|
let result = quoteSample.match(alphabetRegexV2).length;
|
|
|
|
```
|
2018-10-04 13:47:55 +00:00
|
|
|
|
|
|
|
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
|