From 169e0ee58232f42584921224bbf3441070ca209a Mon Sep 17 00:00:00 2001 From: greggubarev Date: Tue, 16 Oct 2018 09:02:04 +0400 Subject: [PATCH] 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 --- .../specify-exact-number-of-matches/index.md | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches/index.md b/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches/index.md index 6047c2c286..dd848375fb 100644 --- a/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches/index.md +++ b/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches/index.md @@ -1,10 +1,21 @@ +--- +title: Specify Exact Number of Matches --- -title: Specify Exact Number of Matches ---- + ## Specify Exact Number of Matches -This is a stub. Help our community expand it. +## The Problem: -This quick style guide will help ensure your pull request gets accepted. +We need to change the regex ```timRegex``` to match the word ```"Timber"``` only when it has four letter ```m```'s. - + ## 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.