Javascript: Added hint to Specify Exact Number of Matches (#19248)

* Javascript: Added hint to Specify Exact Number of Matches

Added hint to Specify Exact Number of Matches (https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches and https://guide.freecodecamp.org/certifications/javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches/)

* Update index.md
This commit is contained in:
greggubarev
2018-10-16 09:02:04 +04:00
committed by Quincy Larson
parent 13ea3c627c
commit 169e0ee582

View File

@ -1,10 +1,21 @@
---
title: Specify Exact Number of Matches
---
## Specify Exact Number of Matches
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
## The 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 change the regex ```timRegex``` to match the word ```"Timber"``` only when it has four letter ```m```'s.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
## Solution:
```js
let timStr = "Timmmmber";
let timRegex = /Tim{4}ber/; // Change this line
let result = timRegex.test(timStr);
```
## Explanation:
With this regex (```/Tim{4}ber/```) we specify a certain number (```4```) of letter ```m```'s.