From e9614d60d4383b74fbc249b3920c6653a158bc05 Mon Sep 17 00:00:00 2001 From: Renato Melo Date: Tue, 19 May 2020 07:50:20 -0300 Subject: [PATCH] fix: update regex specify exact number of matches - lastIndex = 0 before test (#38717) --- .../specify-exact-number-of-matches.english.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.english.md index 2afb9ba663..0aba6737b8 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.english.md @@ -36,15 +36,15 @@ tests: - text: Your regex should use curly brackets. testString: assert(timRegex.source.match(/{.*?}/).length > 0); - text: Your regex should not match "Timber" - testString: assert(!timRegex.test("Timber")); + testString: timRegex.lastIndex = 0; assert(!timRegex.test("Timber")); - text: Your regex should not match "Timmber" - testString: assert(!timRegex.test("Timmber")); + testString: timRegex.lastIndex = 0; assert(!timRegex.test("Timmber")); - text: Your regex should not match "Timmmber" - testString: assert(!timRegex.test("Timmmber")); + testString: timRegex.lastIndex = 0; assert(!timRegex.test("Timmmber")); - text: Your regex should match "Timmmmber" - testString: assert(timRegex.test("Timmmmber")); + testString: timRegex.lastIndex = 0; assert(timRegex.test("Timmmmber")); - text: Your regex should not match "Timber" with 30 m's in it. - testString: assert(!timRegex.test("Ti" + "m".repeat(30) + "ber")); + testString: timRegex.lastIndex = 0; assert(!timRegex.test("Ti" + "m".repeat(30) + "ber")); ```