From 296cf44f57d23bec7715bb0eac24effebeb31ebb Mon Sep 17 00:00:00 2001 From: Rob Anthony Date: Wed, 8 Aug 2018 16:15:09 +0100 Subject: [PATCH] fix(challenges): add test to check user is using \W in Regex Add test to make sure user is using \W and not ^\w --- .../regular-expressions.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 926d4ff640..5b681ec436 100644 --- a/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json +++ b/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json @@ -944,6 +944,10 @@ "text": "Your regex should find 6 non-alphanumeric characters in \"The five boxing wizards jump quickly.\".", "testString": "assert(\"The five boxing wizards jump quickly.\".match(nonAlphabetRegex).length == 6, 'Your regex should find 6 non-alphanumeric characters in \"The five boxing wizards jump quickly.\".');" }, + { + "text": "Your regex should use the shorthand character.", + "testString":"assert(/\\\\W/.test(nonAlphabetRegex.source), 'Your regex should use the shorthand character to match characters which are non-alphanumeric.');" + }, { "text": "Your regex should find 8 non-alphanumeric characters in \"Pack my box with five dozen liquor jugs.\"", "testString": "assert(\"Pack my box with five dozen liquor jugs.\".match(nonAlphabetRegex).length == 8, 'Your regex should find 8 non-alphanumeric characters in \"Pack my box with five dozen liquor jugs.\"');" @@ -1718,4 +1722,4 @@ } } ] -} \ No newline at end of file +}