Javascript: Add hint to Match Everything But Letters and Numbers (#19240)
* Javascript: Add hint to Match Everything But Letters and Numbers Add hint to Match Everything But Letters and Numbers (https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers and https://guide.freecodecamp.org/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers/) * Update index.md
This commit is contained in:
committed by
Quincy Larson
parent
da14642ea1
commit
ad25c1f253
@ -1,10 +1,17 @@
|
||||
---
|
||||
title: Match Everything But Letters and Numbers
|
||||
---
|
||||
title: Match Everything But Letters and Numbers
|
||||
---
|
||||
|
||||
## Match Everything But Letters and Numbers
|
||||
|
||||
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
|
||||
### Problem:
|
||||
|
||||
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
|
||||
We need to use the shorthand character class \W to count the number of non-alphanumeric characters in various quotes and strings.
|
||||
|
||||
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
|
||||
### Solution:
|
||||
|
||||
```js
|
||||
let quoteSample = "The five boxing wizards jump quickly.";
|
||||
let nonAlphabetRegex = /\W/gi; // Change this line
|
||||
let result = quoteSample.match(nonAlphabetRegex).length;
|
||||
```
|
||||
|
Reference in New Issue
Block a user