From fc1dea086d8a4c5a48f4dd6ae17693238a118b81 Mon Sep 17 00:00:00 2001 From: Daksh Shah Date: Sat, 24 Jun 2017 18:53:42 +0300 Subject: [PATCH] Fix test and clarify description for reuse patterns using capture groups --- .../regular-expressions.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json b/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json index bb651561bd..893067c4ee 100644 --- a/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json +++ b/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json @@ -910,7 +910,7 @@ "
let repeatStr = \"regex regex\";
let repeatRegex = /(\\w+)\\s\\1/;
repeatRegex.test(repeatStr); // Returns true
repeatStr.match(repeatRegex); // Returns [\"regex regex\", \"regex\"]
", "Using the .match() method on a string will return an array with the string it matches, along with its capture group.", "
", - "Use capture groups in reRegex to match numbers that appear three times in a string each separated by a space." + "Use capture groups in reRegex to match numbers that are repeated only three times in a string, each separated by a space." ], "challengeSeed": [ "let repeatNum = \"42 42 42\";", @@ -923,7 +923,7 @@ "assert(reRegex.source.match(/\\\\s/g).length === 2, 'message: Your regex should have two spaces separating the three numbers.');", "assert(reRegex.test(\"42 42 42\"), 'message: Your regex should match \"42 42 42\".');", "assert(reRegex.test(\"100 100 100\"), 'message: Your regex should match \"100 100 100\".');", - "assert.equal((\"42 42 42 42\").match(reRegex.source)[0], (\"42 42 42\"), 'message: Your regex should not match \"42 42 42 42\".');", + "assert.equal((\"42 42 42 42\").match(reRegex.source), null, 'message: Your regex should not match \"42 42 42 42\".');", "assert.equal((\"42 42\").match(reRegex.source), null, 'message: Your regex should not match \"42 42\".');", "assert(!reRegex.test(\"101 102 103\"), 'message: Your regex should not match \"101 102 103\".');", "assert(!reRegex.test(\"1 2 3\"), 'message: Your regex should not match \"1 2 3\".');",