From 41aba1615045f81ebbbeb71aa9ebbc14cefe01f8 Mon Sep 17 00:00:00 2001 From: Po Mauguet Date: Fri, 17 Aug 2018 12:03:03 +0200 Subject: [PATCH 1/2] fix(challenges): fix regex in a JS challenge See more details on fix issue https://github.com/freeCodeCamp/learn/issues/269 BREAKING CHANGE: None ISSUES CLOSED: #269 --- .../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 5384eb769..e13d1f7d1 100644 --- a/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json +++ b/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json @@ -946,7 +946,7 @@ }, { "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.');" + "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.\"", @@ -1390,7 +1390,7 @@ "You can specify the lower and upper number of patterns with quantity specifiers using curly brackets. Sometimes you only want a specific number of matches.", "To specify a certain number of patterns, just have that one number between the curly brackets.", "For example, to match only the word \"hah\" with the letter a 3 times, your regex would be /ha{3}h/.", - "
let A4 = \"haaaah\";
let A3 = \"haaah\";
let A100 = \"h\" + \"a\".repeat(100) + \"h\";
let multipleHA = /a{3}h/;
multipleHA.test(A4); // Returns false
multipleHA.test(A3); // Returns true
multipleHA.test(A100); // Returns false
", + "
let A4 = \"haaaah\";
let A3 = \"haaah\";
let A100 = \"h\" + \"a\".repeat(100) + \"h\";
let multipleHA = /ha{3}h/;
multipleHA.test(A4); // Returns false
multipleHA.test(A3); // Returns true
multipleHA.test(A100); // Returns false
", "
", "Change the regex timRegex to match the word \"Timber\" only when it has four letter m's." ], From 4fc745e2dae543cd426aa1426bdf144d8dd080c4 Mon Sep 17 00:00:00 2001 From: Po Mauguet Date: Fri, 17 Aug 2018 12:03:03 +0200 Subject: [PATCH 2/2] fix(challenges): fix regex in a JS challenge See more details on fix issue https://github.com/freeCodeCamp/learn/issues/269 ISSUES CLOSED: #269 --- .../regular-expressions.json | 6 +++--- 1 file changed, 3 insertions(+), 3 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 5384eb769..c02749a48 100644 --- a/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json +++ b/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json @@ -946,7 +946,7 @@ }, { "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.');" + "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.\"", @@ -1390,7 +1390,7 @@ "You can specify the lower and upper number of patterns with quantity specifiers using curly brackets. Sometimes you only want a specific number of matches.", "To specify a certain number of patterns, just have that one number between the curly brackets.", "For example, to match only the word \"hah\" with the letter a 3 times, your regex would be /ha{3}h/.", - "
let A4 = \"haaaah\";
let A3 = \"haaah\";
let A100 = \"h\" + \"a\".repeat(100) + \"h\";
let multipleHA = /a{3}h/;
multipleHA.test(A4); // Returns false
multipleHA.test(A3); // Returns true
multipleHA.test(A100); // Returns false
", + "
let A4 = \"haaaah\";
let A3 = \"haaah\";
let A100 = \"h\" + \"a\".repeat(100) + \"h\";
let multipleHA = /ha{3}h/;
multipleHA.test(A4); // Returns false
multipleHA.test(A3); // Returns true
multipleHA.test(A100); // Returns false
", "
", "Change the regex timRegex to match the word \"Timber\" only when it has four letter m's." ], @@ -1416,7 +1416,7 @@ "testString": "assert(timRegex.test(\"Timmmmber\"), 'Your regex should match \"Timmmmber\"');" }, { - "text": "Your regex should not match \"Timber\" with 30 m\\'s in it.", + "text": "Your regex should not match \"Timber\" with 30 m's in it.", "testString": "assert(!timRegex.test(\"Ti\" + \"m\".repeat(30) + \"ber\"), 'Your regex should not match \"Timber\" with 30 m\\'s in it.');" } ],