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..9b17eea75 100644 --- a/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json +++ b/challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json @@ -18,11 +18,13 @@ "tests": [ { "text": "You should use .test() to test the regex.", - "testString": "assert(code.match(/myRegex.test\\(\\s*myString\\s*\\)/), 'You should use .test() to test the regex.');" + "testString": + "assert(code.match(/myRegex.test\\(\\s*myString\\s*\\)/), 'You should use .test() to test the regex.');" }, { "text": "Your result should return true.", - "testString": "assert(result === true, 'Your result should return true.');" + "testString": + "assert(result === true, 'Your result should return true.');" } ], "solutions": [], @@ -59,16 +61,21 @@ ], "tests": [ { - "text": "Your regex waldoRegex should find \"Waldo\"", - "testString": "assert(waldoRegex.test(waldoIsHiding), 'Your regex waldoRegex should find \"Waldo\"');" + "text": + "Your regex waldoRegex should find \"Waldo\"", + "testString": + "assert(waldoRegex.test(waldoIsHiding), 'Your regex waldoRegex should find \"Waldo\"');" }, { - "text": "Your regex waldoRegex should not search for anything else.", - "testString": "assert(!waldoRegex.test('Somewhere is hiding in this text.'), 'Your regex waldoRegex should not search for anything else.');" + "text": + "Your regex waldoRegex should not search for anything else.", + "testString": + "assert(!waldoRegex.test('Somewhere is hiding in this text.'), 'Your regex waldoRegex should not search for anything else.');" }, { "text": "You should perform a literal string match with your regex.", - "testString": "assert(!/\\/.*\\/i/.test(code), 'You should perform a literal string match with your regex.');" + "testString": + "assert(!/\\/.*\\/i/.test(code), 'You should perform a literal string match with your regex.');" } ], "solutions": [], @@ -104,32 +111,46 @@ ], "tests": [ { - "text": "Your regex petRegex should return true for the string \"John has a pet dog.\"", - "testString": "assert(petRegex.test('John has a pet dog.'), 'Your regex petRegex should return true for the string \"John has a pet dog.\"');" + "text": + "Your regex petRegex should return true for the string \"John has a pet dog.\"", + "testString": + "assert(petRegex.test('John has a pet dog.'), 'Your regex petRegex should return true for the string \"John has a pet dog.\"');" }, { - "text": "Your regex petRegex should return false for the string \"Emma has a pet rock.\"", - "testString": "assert(!petRegex.test('Emma has a pet rock.'), 'Your regex petRegex should return false for the string \"Emma has a pet rock.\"');" + "text": + "Your regex petRegex should return false for the string \"Emma has a pet rock.\"", + "testString": + "assert(!petRegex.test('Emma has a pet rock.'), 'Your regex petRegex should return false for the string \"Emma has a pet rock.\"');" }, { - "text": "Your regex petRegex should return true for the string \"Emma has a pet bird.\"", - "testString": "assert(petRegex.test('Emma has a pet bird.'), 'Your regex petRegex should return true for the string \"Emma has a pet bird.\"');" + "text": + "Your regex petRegex should return true for the string \"Emma has a pet bird.\"", + "testString": + "assert(petRegex.test('Emma has a pet bird.'), 'Your regex petRegex should return true for the string \"Emma has a pet bird.\"');" }, { - "text": "Your regex petRegex should return true for the string \"Liz has a pet cat.\"", - "testString": "assert(petRegex.test('Liz has a pet cat.'), 'Your regex petRegex should return true for the string \"Liz has a pet cat.\"');" + "text": + "Your regex petRegex should return true for the string \"Liz has a pet cat.\"", + "testString": + "assert(petRegex.test('Liz has a pet cat.'), 'Your regex petRegex should return true for the string \"Liz has a pet cat.\"');" }, { - "text": "Your regex petRegex should return false for the string \"Kara has a pet dolphin.\"", - "testString": "assert(!petRegex.test('Kara has a pet dolphin.'), 'Your regex petRegex should return false for the string \"Kara has a pet dolphin.\"');" + "text": + "Your regex petRegex should return false for the string \"Kara has a pet dolphin.\"", + "testString": + "assert(!petRegex.test('Kara has a pet dolphin.'), 'Your regex petRegex should return false for the string \"Kara has a pet dolphin.\"');" }, { - "text": "Your regex petRegex should return true for the string \"Alice has a pet fish.\"", - "testString": "assert(petRegex.test('Alice has a pet fish.'), 'Your regex petRegex should return true for the string \"Alice has a pet fish.\"');" + "text": + "Your regex petRegex should return true for the string \"Alice has a pet fish.\"", + "testString": + "assert(petRegex.test('Alice has a pet fish.'), 'Your regex petRegex should return true for the string \"Alice has a pet fish.\"');" }, { - "text": "Your regex petRegex should return false for the string \"Jimmy has a pet computer.\"", - "testString": "assert(!petRegex.test('Jimmy has a pet computer.'), 'Your regex petRegex should return false for the string \"Jimmy has a pet computer.\"');" + "text": + "Your regex petRegex should return false for the string \"Jimmy has a pet computer.\"", + "testString": + "assert(!petRegex.test('Jimmy has a pet computer.'), 'Your regex petRegex should return false for the string \"Jimmy has a pet computer.\"');" } ], "solutions": [], @@ -165,43 +186,53 @@ "tests": [ { "text": "Your regex should match freeCodeCamp", - "testString": "assert(fccRegex.test('freeCodeCamp'), 'Your regex should match freeCodeCamp');" + "testString": + "assert(fccRegex.test('freeCodeCamp'), 'Your regex should match freeCodeCamp');" }, { "text": "Your regex should match FreeCodeCamp", - "testString": "assert(fccRegex.test('FreeCodeCamp'), 'Your regex should match FreeCodeCamp');" + "testString": + "assert(fccRegex.test('FreeCodeCamp'), 'Your regex should match FreeCodeCamp');" }, { "text": "Your regex should match FreecodeCamp", - "testString": "assert(fccRegex.test('FreecodeCamp'), 'Your regex should match FreecodeCamp');" + "testString": + "assert(fccRegex.test('FreecodeCamp'), 'Your regex should match FreecodeCamp');" }, { "text": "Your regex should match FreeCodecamp", - "testString": "assert(fccRegex.test('FreeCodecamp'), 'Your regex should match FreeCodecamp');" + "testString": + "assert(fccRegex.test('FreeCodecamp'), 'Your regex should match FreeCodecamp');" }, { "text": "Your regex should not match Free Code Camp", - "testString": "assert(!fccRegex.test('Free Code Camp'), 'Your regex should not match Free Code Camp');" + "testString": + "assert(!fccRegex.test('Free Code Camp'), 'Your regex should not match Free Code Camp');" }, { "text": "Your regex should match FreeCOdeCamp", - "testString": "assert(fccRegex.test('FreeCOdeCamp'), 'Your regex should match FreeCOdeCamp');" + "testString": + "assert(fccRegex.test('FreeCOdeCamp'), 'Your regex should match FreeCOdeCamp');" }, { "text": "Your regex should not match FCC", - "testString": "assert(!fccRegex.test('FCC'), 'Your regex should not match FCC');" + "testString": + "assert(!fccRegex.test('FCC'), 'Your regex should not match FCC');" }, { "text": "Your regex should match FrEeCoDeCamp", - "testString": "assert(fccRegex.test('FrEeCoDeCamp'), 'Your regex should match FrEeCoDeCamp');" + "testString": + "assert(fccRegex.test('FrEeCoDeCamp'), 'Your regex should match FrEeCoDeCamp');" }, { "text": "Your regex should match FrEeCodECamp", - "testString": "assert(fccRegex.test('FrEeCodECamp'), 'Your regex should match FrEeCodECamp');" + "testString": + "assert(fccRegex.test('FrEeCodECamp'), 'Your regex should match FrEeCodECamp');" }, { "text": "Your regex should match FReeCodeCAmp", - "testString": "assert(fccRegex.test('FReeCodeCAmp'), 'Your regex should match FReeCodeCAmp');" + "testString": + "assert(fccRegex.test('FReeCodeCAmp'), 'Your regex should match FReeCodeCAmp');" } ], "solutions": [], @@ -236,16 +267,21 @@ ], "tests": [ { - "text": "The result should have the word coding", - "testString": "assert(result.join() === \"coding\", 'The result should have the word coding');" + "text": + "The result should have the word coding", + "testString": + "assert(result.join() === \"coding\", 'The result should have the word coding');" }, { - "text": "Your regex codingRegex should search for coding", - "testString": "assert(codingRegex.source === \"coding\", 'Your regex codingRegex should search for coding');" + "text": + "Your regex codingRegex should search for coding", + "testString": + "assert(codingRegex.source === \"coding\", 'Your regex codingRegex should search for coding');" }, { "text": "You should use the .match() method.", - "testString": "assert(code.match(/\\.match\\(.*\\)/), 'You should use the .match() method.');" + "testString": + "assert(code.match(/\\.match\\(.*\\)/), 'You should use the .match() method.');" } ], "solutions": [], @@ -282,20 +318,28 @@ ], "tests": [ { - "text": "Your regex starRegex should use the global flag g", - "testString": "assert(starRegex.flags.match(/g/).length == 1, 'Your regex starRegex should use the global flag g');" + "text": + "Your regex starRegex should use the global flag g", + "testString": + "assert(starRegex.flags.match(/g/).length == 1, 'Your regex starRegex should use the global flag g');" }, { - "text": "Your regex starRegex should use the case insensitive flag i", - "testString": "assert(starRegex.flags.match(/i/).length == 1, 'Your regex starRegex should use the case insensitive flag i');" + "text": + "Your regex starRegex should use the case insensitive flag i", + "testString": + "assert(starRegex.flags.match(/i/).length == 1, 'Your regex starRegex should use the case insensitive flag i');" }, { - "text": "Your match should match both occurrences of the word \"Twinkle\"", - "testString": "assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join(), 'Your match should match both occurrences of the word \"Twinkle\"');" + "text": + "Your match should match both occurrences of the word \"Twinkle\"", + "testString": + "assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join(), 'Your match should match both occurrences of the word \"Twinkle\"');" }, { - "text": "Your match result should have two elements in it.", - "testString": "assert(result.length == 2, 'Your match result should have two elements in it.');" + "text": + "Your match result should have two elements in it.", + "testString": + "assert(result.length == 2, 'Your match result should have two elements in it.');" } ], "solutions": [], @@ -331,43 +375,62 @@ "tests": [ { "text": "You should use the .test() method.", - "testString": "assert(code.match(/\\.test\\(.*\\)/), 'You should use the .test() method.');" + "testString": + "assert(code.match(/\\.test\\(.*\\)/), 'You should use the .test() method.');" }, { - "text": "You should use the wildcard character in your regex unRegex", - "testString": "assert(/\\./.test(unRegex.source), 'You should use the wildcard character in your regex unRegex');" + "text": + "You should use the wildcard character in your regex unRegex", + "testString": + "assert(/\\./.test(unRegex.source), 'You should use the wildcard character in your regex unRegex');" }, { - "text": "Your regex unRegex should match \"run\" in \"Let us go on a run.\"", - "testString": "assert(unRegex.test(\"Let us go on a run.\"), 'Your regex unRegex should match \"run\" in \"Let us go on a run.\"');" + "text": + "Your regex unRegex should match \"run\" in \"Let us go on a run.\"", + "testString": + "assert(unRegex.test(\"Let us go on a run.\"), 'Your regex unRegex should match \"run\" in \"Let us go on a run.\"');" }, { - "text": "Your regex unRegex should match \"sun\" in \"The sun is out today.\"", - "testString": "assert(unRegex.test(\"The sun is out today.\"), 'Your regex unRegex should match \"sun\" in \"The sun is out today.\"');" + "text": + "Your regex unRegex should match \"sun\" in \"The sun is out today.\"", + "testString": + "assert(unRegex.test(\"The sun is out today.\"), 'Your regex unRegex should match \"sun\" in \"The sun is out today.\"');" }, { - "text": "Your regex unRegex should match \"fun\" in \"Coding is a lot of fun.\"", - "testString": "assert(unRegex.test(\"Coding is a lot of fun.\"), 'Your regex unRegex should match \"fun\" in \"Coding is a lot of fun.\"');" + "text": + "Your regex unRegex should match \"fun\" in \"Coding is a lot of fun.\"", + "testString": + "assert(unRegex.test(\"Coding is a lot of fun.\"), 'Your regex unRegex should match \"fun\" in \"Coding is a lot of fun.\"');" }, { - "text": "Your regex unRegex should match \"pun\" in \"Seven days without a pun makes one weak.\"", - "testString": "assert(unRegex.test(\"Seven days without a pun makes one weak.\"), 'Your regex unRegex should match \"pun\" in \"Seven days without a pun makes one weak.\"');" + "text": + "Your regex unRegex should match \"pun\" in \"Seven days without a pun makes one weak.\"", + "testString": + "assert(unRegex.test(\"Seven days without a pun makes one weak.\"), 'Your regex unRegex should match \"pun\" in \"Seven days without a pun makes one weak.\"');" }, { - "text": "Your regex unRegex should match \"nun\" in \"One takes a vow to be a nun.\"", - "testString": "assert(unRegex.test(\"One takes a vow to be a nun.\"), 'Your regex unRegex should match \"nun\" in \"One takes a vow to be a nun.\"');" + "text": + "Your regex unRegex should match \"nun\" in \"One takes a vow to be a nun.\"", + "testString": + "assert(unRegex.test(\"One takes a vow to be a nun.\"), 'Your regex unRegex should match \"nun\" in \"One takes a vow to be a nun.\"');" }, { - "text": "Your regex unRegex should match \"bun\" in \"She got fired from the hot dog stand for putting her hair in a bun.\"", - "testString": "assert(unRegex.test(\"She got fired from the hot dog stand for putting her hair in a bun.\"), 'Your regex unRegex should match \"bun\" in \"She got fired from the hot dog stand for putting her hair in a bun.\"');" + "text": + "Your regex unRegex should match \"bun\" in \"She got fired from the hot dog stand for putting her hair in a bun.\"", + "testString": + "assert(unRegex.test(\"She got fired from the hot dog stand for putting her hair in a bun.\"), 'Your regex unRegex should match \"bun\" in \"She got fired from the hot dog stand for putting her hair in a bun.\"');" }, { - "text": "Your regex unRegex should not match \"There is a bug in my code.\"", - "testString": "assert(!unRegex.test(\"There is a bug in my code.\"), 'Your regex unRegex should not match \"There is a bug in my code.\"');" + "text": + "Your regex unRegex should not match \"There is a bug in my code.\"", + "testString": + "assert(!unRegex.test(\"There is a bug in my code.\"), 'Your regex unRegex should not match \"There is a bug in my code.\"');" }, { - "text": "Your regex unRegex should not match \"Catch me if you can.\"", - "testString": "assert(!unRegex.test(\"Can me if you can.\"), 'Your regex unRegex should not match \"Catch me if you can.\"');" + "text": + "Your regex unRegex should not match \"Catch me if you can.\"", + "testString": + "assert(!unRegex.test(\"Can me if you can.\"), 'Your regex unRegex should not match \"Catch me if you can.\"');" } ], "solutions": [], @@ -405,23 +468,31 @@ "tests": [ { "text": "You should find all 25 vowels.", - "testString": "assert(result.length == 25, 'You should find all 25 vowels.');" + "testString": + "assert(result.length == 25, 'You should find all 25 vowels.');" }, { - "text": "Your regex vowelRegex should use a character class.", - "testString": "assert(/\\[.*\\]/.test(vowelRegex.source), 'Your regex vowelRegex should use a character class.');" + "text": + "Your regex vowelRegex should use a character class.", + "testString": + "assert(/\\[.*\\]/.test(vowelRegex.source), 'Your regex vowelRegex should use a character class.');" }, { - "text": "Your regex vowelRegex should use the global flag.", - "testString": "assert(vowelRegex.flags.match(/g/).length == 1, 'Your regex vowelRegex should use the global flag.');" + "text": + "Your regex vowelRegex should use the global flag.", + "testString": + "assert(vowelRegex.flags.match(/g/).length == 1, 'Your regex vowelRegex should use the global flag.');" }, { - "text": "Your regex vowelRegex should use the case insensitive flag.", - "testString": "assert(vowelRegex.flags.match(/i/).length == 1, 'Your regex vowelRegex should use the case insensitive flag.');" + "text": + "Your regex vowelRegex should use the case insensitive flag.", + "testString": + "assert(vowelRegex.flags.match(/i/).length == 1, 'Your regex vowelRegex should use the case insensitive flag.');" }, { "text": "Your regex should not match any consonants.", - "testString": "assert(!/[b-df-hj-np-tv-z]/gi.test(result.join()), 'Your regex should not match any consonants.');" + "testString": + "assert(!/[b-df-hj-np-tv-z]/gi.test(result.join()), 'Your regex should not match any consonants.');" } ], "solutions": [], @@ -458,16 +529,22 @@ ], "tests": [ { - "text": "Your regex alphabetRegex should match 35 items.", - "testString": "assert(result.length == 35, 'Your regex alphabetRegex should match 35 items.');" + "text": + "Your regex alphabetRegex should match 35 items.", + "testString": + "assert(result.length == 35, 'Your regex alphabetRegex should match 35 items.');" }, { - "text": "Your regex alphabetRegex should use the global flag.", - "testString": "assert(alphabetRegex.flags.match(/g/).length == 1, 'Your regex alphabetRegex should use the global flag.');" + "text": + "Your regex alphabetRegex should use the global flag.", + "testString": + "assert(alphabetRegex.flags.match(/g/).length == 1, 'Your regex alphabetRegex should use the global flag.');" }, { - "text": "Your regex alphabetRegex should use the case insensitive flag.", - "testString": "assert(alphabetRegex.flags.match(/i/).length == 1, 'Your regex alphabetRegex should use the case insensitive flag.');" + "text": + "Your regex alphabetRegex should use the case insensitive flag.", + "testString": + "assert(alphabetRegex.flags.match(/i/).length == 1, 'Your regex alphabetRegex should use the case insensitive flag.');" } ], "solutions": [], @@ -504,15 +581,19 @@ "tests": [ { "text": "Your regex myRegex should match 17 items.", - "testString": "assert(result.length == 17, 'Your regex myRegex should match 17 items.');" + "testString": + "assert(result.length == 17, 'Your regex myRegex should match 17 items.');" }, { "text": "Your regex myRegex should use the global flag.", - "testString": "assert(myRegex.flags.match(/g/).length == 1, 'Your regex myRegex should use the global flag.');" + "testString": + "assert(myRegex.flags.match(/g/).length == 1, 'Your regex myRegex should use the global flag.');" }, { - "text": "Your regex myRegex should use the case insensitive flag.", - "testString": "assert(myRegex.flags.match(/i/).length == 1, 'Your regex myRegex should use the case insensitive flag.');" + "text": + "Your regex myRegex should use the case insensitive flag.", + "testString": + "assert(myRegex.flags.match(/i/).length == 1, 'Your regex myRegex should use the case insensitive flag.');" } ], "solutions": [], @@ -548,15 +629,19 @@ "tests": [ { "text": "Your regex myRegex should match 9 items.", - "testString": "assert(result.length == 9, 'Your regex myRegex should match 9 items.');" + "testString": + "assert(result.length == 9, 'Your regex myRegex should match 9 items.');" }, { "text": "Your regex myRegex should use the global flag.", - "testString": "assert(myRegex.flags.match(/g/).length == 1, 'Your regex myRegex should use the global flag.');" + "testString": + "assert(myRegex.flags.match(/g/).length == 1, 'Your regex myRegex should use the global flag.');" }, { - "text": "Your regex myRegex should use the case insensitive flag.", - "testString": "assert(myRegex.flags.match(/i/).length == 1, 'Your regex myRegex should use the case insensitive flag.');" + "text": + "Your regex myRegex should use the case insensitive flag.", + "testString": + "assert(myRegex.flags.match(/i/).length == 1, 'Your regex myRegex should use the case insensitive flag.');" } ], "solutions": [], @@ -592,16 +677,21 @@ ], "tests": [ { - "text": "Your regex myRegex should use the + sign to match one or more s characters.", - "testString": "assert(/\\+/.test(myRegex.source), 'Your regex myRegex should use the + sign to match one or more s characters.');" + "text": + "Your regex myRegex should use the + sign to match one or more s characters.", + "testString": + "assert(/\\+/.test(myRegex.source), 'Your regex myRegex should use the + sign to match one or more s characters.');" }, { "text": "Your regex myRegex should match 2 items.", - "testString": "assert(result.length == 2, 'Your regex myRegex should match 2 items.');" + "testString": + "assert(result.length == 2, 'Your regex myRegex should match 2 items.');" }, { - "text": "The result variable should be an array with two matches of \"ss\"", - "testString": "assert(result[0] == 'ss' && result[1] == 'ss', 'The result variable should be an array with two matches of \"ss\"');" + "text": + "The result variable should be an array with two matches of \"ss\"", + "testString": + "assert(result[0] == 'ss' && result[1] == 'ss', 'The result variable should be an array with two matches of \"ss\"');" } ], "solutions": [], @@ -636,24 +726,33 @@ ], "tests": [ { - "text": "Your regex chewieRegex should use the * character to match zero or more a characters.", - "testString": "assert(/\\*/.test(chewieRegex.source), 'Your regex chewieRegex should use the * character to match zero or more a characters.');" + "text": + "Your regex chewieRegex should use the * character to match zero or more a characters.", + "testString": + "assert(/\\*/.test(chewieRegex.source), 'Your regex chewieRegex should use the * character to match zero or more a characters.');" }, { - "text": "Your regex chewieRegex should match 16 characters.", - "testString": "assert(result[0].length === 16, 'Your regex chewieRegex should match 16 characters.');" + "text": + "Your regex chewieRegex should match 16 characters.", + "testString": + "assert(result[0].length === 16, 'Your regex chewieRegex should match 16 characters.');" }, { "text": "Your regex should match \"Aaaaaaaaaaaaaaaa\".", - "testString": "assert(result[0] === 'Aaaaaaaaaaaaaaaa', 'Your regex should match \"Aaaaaaaaaaaaaaaa\".');" + "testString": + "assert(result[0] === 'Aaaaaaaaaaaaaaaa', 'Your regex should match \"Aaaaaaaaaaaaaaaa\".');" }, { - "text": "Your regex should not match any characters in \"He made a fair move. Screaming about it can't help you.\"", - "testString": "assert(!\"He made a fair move. Screaming about it can\\'t help you.\".match(chewieRegex), 'Your regex should not match any characters in \"He made a fair move. Screaming about it can't help you.\"');" + "text": + "Your regex should not match any characters in \"He made a fair move. Screaming about it can't help you.\"", + "testString": + "assert(!\"He made a fair move. Screaming about it can\\'t help you.\".match(chewieRegex), 'Your regex should not match any characters in \"He made a fair move. Screaming about it can't help you.\"');" }, { - "text": "Your regex should not match any characters in \"Let him have it. It's not wise to upset a Wookiee.\"", - "testString": "assert(!\"Let him have it. It\\'s not wise to upset a Wookiee.\".match(chewieRegex), 'Your regex should not match any characters in \"Let him have it. It's not wise to upset a Wookiee.\"');" + "text": + "Your regex should not match any characters in \"Let him have it. It's not wise to upset a Wookiee.\"", + "testString": + "assert(!\"Let him have it. It\\'s not wise to upset a Wookiee.\".match(chewieRegex), 'Your regex should not match any characters in \"Let him have it. It's not wise to upset a Wookiee.\"');" } ], "solutions": [], @@ -689,8 +788,10 @@ ], "tests": [ { - "text": "The result variable should be an array with <h1> in it", - "testString": "assert(result[0] == '

', 'The result variable should be an array with <h1> in it');" + "text": + "The result variable should be an array with <h1> in it", + "testString": + "assert(result[0] == '

', 'The result variable should be an array with <h1> in it');" } ], "solutions": [], @@ -728,32 +829,46 @@ ], "tests": [ { - "text": "Your regex should match one criminal (\"C\") in \"C\"", - "testString": "assert('C'.match(reCriminals) && 'C'.match(reCriminals)[0] == 'C', 'Your regex should match one criminal (\"C\") in \"C\"');" + "text": + "Your regex should match one criminal (\"C\") in \"C\"", + "testString": + "assert('C'.match(reCriminals) && 'C'.match(reCriminals)[0] == 'C', 'Your regex should match one criminal (\"C\") in \"C\"');" }, { - "text": "Your regex should match two criminals (\"CC\") in \"CC\"", - "testString": "assert('CC'.match(reCriminals) && 'CC'.match(reCriminals)[0] == 'CC', 'Your regex should match two criminals (\"CC\") in \"CC\"');" + "text": + "Your regex should match two criminals (\"CC\") in \"CC\"", + "testString": + "assert('CC'.match(reCriminals) && 'CC'.match(reCriminals)[0] == 'CC', 'Your regex should match two criminals (\"CC\") in \"CC\"');" }, { - "text": "Your regex should match three criminals (\"CCC\") in \"P1P5P4CCCP2P6P3\"", - "testString": "assert('P1P5P4CCCP2P6P3'.match(reCriminals) && 'P1P5P4CCCP2P6P3'.match(reCriminals)[0] == 'CCC', 'Your regex should match three criminals (\"CCC\") in \"P1P5P4CCCP2P6P3\"');" + "text": + "Your regex should match three criminals (\"CCC\") in \"P1P5P4CCCP2P6P3\"", + "testString": + "assert('P1P5P4CCCP2P6P3'.match(reCriminals) && 'P1P5P4CCCP2P6P3'.match(reCriminals)[0] == 'CCC', 'Your regex should match three criminals (\"CCC\") in \"P1P5P4CCCP2P6P3\"');" }, { - "text": "Your regex should match five criminals (\"CCCCC\") in \"P6P2P7P4P5CCCCCP3P1\"", - "testString": "assert('P6P2P7P4P5CCCCCP3P1'.match(reCriminals) && 'P6P2P7P4P5CCCCCP3P1'.match(reCriminals)[0] == 'CCCCC', 'Your regex should match five criminals (\"CCCCC\") in \"P6P2P7P4P5CCCCCP3P1\"');" + "text": + "Your regex should match five criminals (\"CCCCC\") in \"P6P2P7P4P5CCCCCP3P1\"", + "testString": + "assert('P6P2P7P4P5CCCCCP3P1'.match(reCriminals) && 'P6P2P7P4P5CCCCCP3P1'.match(reCriminals)[0] == 'CCCCC', 'Your regex should match five criminals (\"CCCCC\") in \"P6P2P7P4P5CCCCCP3P1\"');" }, { - "text": "Your regex should not match any criminals in \"\"", - "testString": "assert(!reCriminals.test(''), 'Your regex should not match any criminals in \"\"');" + "text": + "Your regex should not match any criminals in \"\"", + "testString": + "assert(!reCriminals.test(''), 'Your regex should not match any criminals in \"\"');" }, { - "text": "Your regex should not match any criminals in \"P1P2P3\"", - "testString": "assert(!reCriminals.test('P1P2P3'), 'Your regex should not match any criminals in \"P1P2P3\"');" + "text": + "Your regex should not match any criminals in \"P1P2P3\"", + "testString": + "assert(!reCriminals.test('P1P2P3'), 'Your regex should not match any criminals in \"P1P2P3\"');" }, { - "text": "Your regex should match fifty criminals (\"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\") in \"P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3\".", - "testString": "assert('P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals) && 'P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals)[0] == \"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\", 'Your regex should match fifty criminals (\"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\") in \"P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3\".');" + "text": + "Your regex should match fifty criminals (\"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\") in \"P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3\".", + "testString": + "assert('P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals) && 'P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals)[0] == \"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\", 'Your regex should match fifty criminals (\"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\") in \"P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3\".');" } ], "solutions": [], @@ -792,20 +907,27 @@ ], "tests": [ { - "text": "Your regex should search for \"Cal\" with a capital letter.", - "testString": "assert(calRegex.source == \"^Cal\", 'Your regex should search for \"Cal\" with a capital letter.');" + "text": + "Your regex should search for \"Cal\" with a capital letter.", + "testString": + "assert(calRegex.source == \"^Cal\", 'Your regex should search for \"Cal\" with a capital letter.');" }, { "text": "Your regex should not use any flags.", - "testString": "assert(calRegex.flags == \"\", 'Your regex should not use any flags.');" + "testString": + "assert(calRegex.flags == \"\", 'Your regex should not use any flags.');" }, { - "text": "Your regex should match \"Cal\" at the beginning of the string.", - "testString": "assert(calRegex.test(\"Cal and Ricky both like racing.\"), 'Your regex should match \"Cal\" at the beginning of the string.');" + "text": + "Your regex should match \"Cal\" at the beginning of the string.", + "testString": + "assert(calRegex.test(\"Cal and Ricky both like racing.\"), 'Your regex should match \"Cal\" at the beginning of the string.');" }, { - "text": "Your regex should not match \"Cal\" in the middle of a string.", - "testString": "assert(!calRegex.test(\"Ricky and Cal both like racing.\"), 'Your regex should not match \"Cal\" in the middle of a string.');" + "text": + "Your regex should not match \"Cal\" in the middle of a string.", + "testString": + "assert(!calRegex.test(\"Ricky and Cal both like racing.\"), 'Your regex should not match \"Cal\" in the middle of a string.');" } ], "solutions": [], @@ -840,16 +962,21 @@ ], "tests": [ { - "text": "You should search for \"caboose\" with the dollar sign $ anchor in your regex.", - "testString": "assert(lastRegex.source == \"caboose$\", 'You should search for \"caboose\" with the dollar sign $ anchor in your regex.');" + "text": + "You should search for \"caboose\" with the dollar sign $ anchor in your regex.", + "testString": + "assert(lastRegex.source == \"caboose$\", 'You should search for \"caboose\" with the dollar sign $ anchor in your regex.');" }, { "text": "Your regex should not use any flags.", - "testString": "assert(lastRegex.flags == \"\", 'Your regex should not use any flags.');" + "testString": + "assert(lastRegex.flags == \"\", 'Your regex should not use any flags.');" }, { - "text": "You should match \"caboose\" at the end of the string \"The last car on a train is the caboose\"", - "testString": "assert(lastRegex.test(\"The last car on a train is the caboose\"), 'You should match \"caboose\" at the end of the string \"The last car on a train is the caboose\"');" + "text": + "You should match \"caboose\" at the end of the string \"The last car on a train is the caboose\"", + "testString": + "assert(lastRegex.test(\"The last car on a train is the caboose\"), 'You should match \"caboose\" at the end of the string \"The last car on a train is the caboose\"');" } ], "solutions": [], @@ -886,23 +1013,37 @@ "tests": [ { "text": "Your regex should use the global flag.", - "testString": "assert(alphabetRegexV2.global, 'Your regex should use the global flag.');" + "testString": + "assert(alphabetRegexV2.global, 'Your regex should use the global flag.');" }, { - "text": "Your regex should find 31 alphanumeric characters in \"The five boxing wizards jump quickly.\"", - "testString": "assert(\"The five boxing wizards jump quickly.\".match(alphabetRegexV2).length === 31, 'Your regex should find 31 alphanumeric characters in \"The five boxing wizards jump quickly.\"');" + "text": "Your regex should use the shorthand character", + "testString": + "assert(/\\\\w/.test(alphabetRegexV2.source), 'Your regex should use the shorthand character \\w to match all characters which are alphanumeric.');" }, { - "text": "Your regex should find 32 alphanumeric characters in \"Pack my box with five dozen liquor jugs.\"", - "testString": "assert(\"Pack my box with five dozen liquor jugs.\".match(alphabetRegexV2).length === 32, 'Your regex should find 32 alphanumeric characters in \"Pack my box with five dozen liquor jugs.\"');" + "text": + "Your regex should find 31 alphanumeric characters in \"The five boxing wizards jump quickly.\"", + "testString": + "assert(\"The five boxing wizards jump quickly.\".match(alphabetRegexV2).length === 31, 'Your regex should find 31 alphanumeric characters in \"The five boxing wizards jump quickly.\"');" }, { - "text": "Your regex should find 30 alphanumeric characters in \"How vexingly quick daft zebras jump!\"", - "testString": "assert(\"How vexingly quick daft zebras jump!\".match(alphabetRegexV2).length === 30, 'Your regex should find 30 alphanumeric characters in \"How vexingly quick daft zebras jump!\"');" + "text": + "Your regex should find 32 alphanumeric characters in \"Pack my box with five dozen liquor jugs.\"", + "testString": + "assert(\"Pack my box with five dozen liquor jugs.\".match(alphabetRegexV2).length === 32, 'Your regex should find 32 alphanumeric characters in \"Pack my box with five dozen liquor jugs.\"');" }, { - "text": "Your regex should find 36 alphanumeric characters in \"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\"", - "testString": "assert(\"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\".match(alphabetRegexV2).length === 36, 'Your regex should find 36 alphanumeric characters in \"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\"');" + "text": + "Your regex should find 30 alphanumeric characters in \"How vexingly quick daft zebras jump!\"", + "testString": + "assert(\"How vexingly quick daft zebras jump!\".match(alphabetRegexV2).length === 30, 'Your regex should find 30 alphanumeric characters in \"How vexingly quick daft zebras jump!\"');" + }, + { + "text": + "Your regex should find 36 alphanumeric characters in \"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\"", + "testString": + "assert(\"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\".match(alphabetRegexV2).length === 36, 'Your regex should find 36 alphanumeric characters in \"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\"');" } ], "solutions": [], @@ -938,11 +1079,14 @@ "tests": [ { "text": "Your regex should use the global flag.", - "testString": "assert(nonAlphabetRegex.global, 'Your regex should use the global flag.');" + "testString": + "assert(nonAlphabetRegex.global, 'Your regex should use the global flag.');" }, { - "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 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.", @@ -953,12 +1097,16 @@ "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.\"');" }, { - "text": "Your regex should find 6 non-alphanumeric characters in \"How vexingly quick daft zebras jump!\"", - "testString": "assert(\"How vexingly quick daft zebras jump!\".match(nonAlphabetRegex).length == 6, 'Your regex should find 6 non-alphanumeric characters in \"How vexingly quick daft zebras jump!\"');" + "text": + "Your regex should find 6 non-alphanumeric characters in \"How vexingly quick daft zebras jump!\"", + "testString": + "assert(\"How vexingly quick daft zebras jump!\".match(nonAlphabetRegex).length == 6, 'Your regex should find 6 non-alphanumeric characters in \"How vexingly quick daft zebras jump!\"');" }, { - "text": "Your regex should find 12 non-alphanumeric characters in \"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\"", - "testString": "assert(\"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\".match(nonAlphabetRegex).length == 12, 'Your regex should find 12 non-alphanumeric characters in \"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\"');" + "text": + "Your regex should find 12 non-alphanumeric characters in \"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\"", + "testString": + "assert(\"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\".match(nonAlphabetRegex).length == 12, 'Your regex should find 12 non-alphanumeric characters in \"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.\"');" } ], "solutions": [], @@ -992,36 +1140,50 @@ ], "tests": [ { - "text": "Your regex should use the shortcut character to match digit characters", - "testString": "assert(/\\\\d/.test(numRegex.source), 'Your regex should use the shortcut character to match digit characters');" + "text": + "Your regex should use the shortcut character to match digit characters", + "testString": + "assert(/\\\\d/.test(numRegex.source), 'Your regex should use the shortcut character to match digit characters');" }, { "text": "Your regex should use the global flag.", - "testString": "assert(numRegex.global, 'Your regex should use the global flag.');" + "testString": + "assert(numRegex.global, 'Your regex should use the global flag.');" }, { "text": "Your regex should find 1 digit in \"9\".", - "testString": "assert(\"9\".match(numRegex).length == 1, 'Your regex should find 1 digit in \"9\".');" + "testString": + "assert(\"9\".match(numRegex).length == 1, 'Your regex should find 1 digit in \"9\".');" }, { - "text": "Your regex should find 2 digits in \"Catch 22\".", - "testString": "assert(\"Catch 22\".match(numRegex).length == 2, 'Your regex should find 2 digits in \"Catch 22\".');" + "text": + "Your regex should find 2 digits in \"Catch 22\".", + "testString": + "assert(\"Catch 22\".match(numRegex).length == 2, 'Your regex should find 2 digits in \"Catch 22\".');" }, { - "text": "Your regex should find 3 digits in \"101 Dalmatians\".", - "testString": "assert(\"101 Dalmatians\".match(numRegex).length == 3, 'Your regex should find 3 digits in \"101 Dalmatians\".');" + "text": + "Your regex should find 3 digits in \"101 Dalmatians\".", + "testString": + "assert(\"101 Dalmatians\".match(numRegex).length == 3, 'Your regex should find 3 digits in \"101 Dalmatians\".');" }, { - "text": "Your regex should find no digits in \"One, Two, Three\".", - "testString": "assert(\"One, Two, Three\".match(numRegex) == null, 'Your regex should find no digits in \"One, Two, Three\".');" + "text": + "Your regex should find no digits in \"One, Two, Three\".", + "testString": + "assert(\"One, Two, Three\".match(numRegex) == null, 'Your regex should find no digits in \"One, Two, Three\".');" }, { - "text": "Your regex should find 2 digits in \"21 Jump Street\".", - "testString": "assert(\"21 Jump Street\".match(numRegex).length == 2, 'Your regex should find 2 digits in \"21 Jump Street\".');" + "text": + "Your regex should find 2 digits in \"21 Jump Street\".", + "testString": + "assert(\"21 Jump Street\".match(numRegex).length == 2, 'Your regex should find 2 digits in \"21 Jump Street\".');" }, { - "text": "Your regex should find 4 digits in \"2001: A Space Odyssey\".", - "testString": "assert(\"2001: A Space Odyssey\".match(numRegex).length == 4, 'Your regex should find 4 digits in \"2001: A Space Odyssey\".');" + "text": + "Your regex should find 4 digits in \"2001: A Space Odyssey\".", + "testString": + "assert(\"2001: A Space Odyssey\".match(numRegex).length == 4, 'Your regex should find 4 digits in \"2001: A Space Odyssey\".');" } ], "solutions": [], @@ -1055,36 +1217,50 @@ ], "tests": [ { - "text": "Your regex should use the shortcut character to match non-digit characters", - "testString": "assert(/\\\\D/.test(noNumRegex.source), 'Your regex should use the shortcut character to match non-digit characters');" + "text": + "Your regex should use the shortcut character to match non-digit characters", + "testString": + "assert(/\\\\D/.test(noNumRegex.source), 'Your regex should use the shortcut character to match non-digit characters');" }, { "text": "Your regex should use the global flag.", - "testString": "assert(noNumRegex.global, 'Your regex should use the global flag.');" + "testString": + "assert(noNumRegex.global, 'Your regex should use the global flag.');" }, { "text": "Your regex should find no non-digits in \"9\".", - "testString": "assert(\"9\".match(noNumRegex) == null, 'Your regex should find no non-digits in \"9\".');" + "testString": + "assert(\"9\".match(noNumRegex) == null, 'Your regex should find no non-digits in \"9\".');" }, { - "text": "Your regex should find 6 non-digits in \"Catch 22\".", - "testString": "assert(\"Catch 22\".match(noNumRegex).length == 6, 'Your regex should find 6 non-digits in \"Catch 22\".');" + "text": + "Your regex should find 6 non-digits in \"Catch 22\".", + "testString": + "assert(\"Catch 22\".match(noNumRegex).length == 6, 'Your regex should find 6 non-digits in \"Catch 22\".');" }, { - "text": "Your regex should find 11 non-digits in \"101 Dalmatians\".", - "testString": "assert(\"101 Dalmatians\".match(noNumRegex).length == 11, 'Your regex should find 11 non-digits in \"101 Dalmatians\".');" + "text": + "Your regex should find 11 non-digits in \"101 Dalmatians\".", + "testString": + "assert(\"101 Dalmatians\".match(noNumRegex).length == 11, 'Your regex should find 11 non-digits in \"101 Dalmatians\".');" }, { - "text": "Your regex should find 15 non-digits in \"One, Two, Three\".", - "testString": "assert(\"One, Two, Three\".match(noNumRegex).length == 15, 'Your regex should find 15 non-digits in \"One, Two, Three\".');" + "text": + "Your regex should find 15 non-digits in \"One, Two, Three\".", + "testString": + "assert(\"One, Two, Three\".match(noNumRegex).length == 15, 'Your regex should find 15 non-digits in \"One, Two, Three\".');" }, { - "text": "Your regex should find 12 non-digits in \"21 Jump Street\".", - "testString": "assert(\"21 Jump Street\".match(noNumRegex).length == 12, 'Your regex should find 12 non-digits in \"21 Jump Street\".');" + "text": + "Your regex should find 12 non-digits in \"21 Jump Street\".", + "testString": + "assert(\"21 Jump Street\".match(noNumRegex).length == 12, 'Your regex should find 12 non-digits in \"21 Jump Street\".');" }, { - "text": "Your regex should find 17 non-digits in \"2001: A Space Odyssey\".", - "testString": "assert(\"2001: A Space Odyssey\".match(noNumRegex).length == 17, 'Your regex should find 17 non-digits in \"2001: A Space Odyssey\".');" + "text": + "Your regex should find 17 non-digits in \"2001: A Space Odyssey\".", + "testString": + "assert(\"2001: A Space Odyssey\".match(noNumRegex).length == 17, 'Your regex should find 17 non-digits in \"2001: A Space Odyssey\".');" } ], "solutions": [], @@ -1122,27 +1298,33 @@ "tests": [ { "text": "Your regex should match JACK", - "testString": "assert(userCheck.test(\"JACK\"), 'Your regex should match JACK');" + "testString": + "assert(userCheck.test(\"JACK\"), 'Your regex should match JACK');" }, { "text": "Your regex should not match J", - "testString": "assert(!userCheck.test(\"J\"), 'Your regex should not match J');" + "testString": + "assert(!userCheck.test(\"J\"), 'Your regex should not match J');" }, { "text": "Your regex should match Oceans11", - "testString": "assert(userCheck.test(\"Oceans11\"), 'Your regex should match Oceans11');" + "testString": + "assert(userCheck.test(\"Oceans11\"), 'Your regex should match Oceans11');" }, { "text": "Your regex should match RegexGuru", - "testString": "assert(userCheck.test(\"RegexGuru\"), 'Your regex should match RegexGuru');" + "testString": + "assert(userCheck.test(\"RegexGuru\"), 'Your regex should match RegexGuru');" }, { "text": "Your regex should not match 007", - "testString": "assert(!userCheck.test(\"007\"), 'Your regex should not match 007');" + "testString": + "assert(!userCheck.test(\"007\"), 'Your regex should not match 007');" }, { "text": "Your regex should not match 9", - "testString": "assert(!userCheck.test(\"9\"), 'Your regex should not match 9');" + "testString": + "assert(!userCheck.test(\"9\"), 'Your regex should not match 9');" } ], "solutions": [], @@ -1178,19 +1360,31 @@ "tests": [ { "text": "Your regex should use the global flag.", - "testString": "assert(countWhiteSpace.global, 'Your regex should use the global flag.');" + "testString": + "assert(countWhiteSpace.global, 'Your regex should use the global flag.');" + }, + { + "text": "Your regex should use the shorthand character", + "testString": + "assert(/\\\\s/.test(countWhiteSpace.source), 'Your regex should use the shorthand character \\s to match all whitespace characters.');" }, { - "text": "Your regex should find eight spaces in \"Men are from Mars and women are from Venus.\"", - "testString": "assert(\"Men are from Mars and women are from Venus.\".match(countWhiteSpace).length == 8, 'Your regex should find eight spaces in \"Men are from Mars and women are from Venus.\"');" + "text": + "Your regex should find eight spaces in \"Men are from Mars and women are from Venus.\"", + "testString": + "assert(\"Men are from Mars and women are from Venus.\".match(countWhiteSpace).length == 8, 'Your regex should find eight spaces in \"Men are from Mars and women are from Venus.\"');" }, { - "text": "Your regex should find three spaces in \"Space: the final frontier.\"", - "testString": "assert(\"Space: the final frontier.\".match(countWhiteSpace).length == 3, 'Your regex should find three spaces in \"Space: the final frontier.\"');" + "text": + "Your regex should find three spaces in \"Space: the final frontier.\"", + "testString": + "assert(\"Space: the final frontier.\".match(countWhiteSpace).length == 3, 'Your regex should find three spaces in \"Space: the final frontier.\"');" }, { - "text": "Your regex should find no spaces in \"MindYourPersonalSpace\"", - "testString": "assert(\"MindYourPersonalSpace\".match(countWhiteSpace) == null, 'Your regex should find no spaces in \"MindYourPersonalSpace\"');" + "text": + "Your regex should find no spaces in \"MindYourPersonalSpace\"", + "testString": + "assert(\"MindYourPersonalSpace\".match(countWhiteSpace) == null, 'Your regex should find no spaces in \"MindYourPersonalSpace\"');" } ], "solutions": [], @@ -1226,19 +1420,31 @@ "tests": [ { "text": "Your regex should use the global flag.", - "testString": "assert(countNonWhiteSpace.global, 'Your regex should use the global flag.');" + "testString": + "assert(countNonWhiteSpace.global, 'Your regex should use the global flag.');" + }, + { + "text": "Your regex should use the shorthand character", + "testString": + "assert(/\\\\S/.test(countNonWhiteSpace.source), 'Your regex should use the shorthand character \\S/code> to match all non-whitespace characters.');" }, { - "text": "Your regex should find 35 non-spaces in \"Men are from Mars and women are from Venus.\"", - "testString": "assert(\"Men are from Mars and women are from Venus.\".match(countNonWhiteSpace).length == 35, 'Your regex should find 35 non-spaces in \"Men are from Mars and women are from Venus.\"');" + "text": + "Your regex should find 35 non-spaces in \"Men are from Mars and women are from Venus.\"", + "testString": + "assert(\"Men are from Mars and women are from Venus.\".match(countNonWhiteSpace).length == 35, 'Your regex should find 35 non-spaces in \"Men are from Mars and women are from Venus.\"');" }, { - "text": "Your regex should find 23 non-spaces in \"Space: the final frontier.\"", - "testString": "assert(\"Space: the final frontier.\".match(countNonWhiteSpace).length == 23, 'Your regex should find 23 non-spaces in \"Space: the final frontier.\"');" + "text": + "Your regex should find 23 non-spaces in \"Space: the final frontier.\"", + "testString": + "assert(\"Space: the final frontier.\".match(countNonWhiteSpace).length == 23, 'Your regex should find 23 non-spaces in \"Space: the final frontier.\"');" }, { - "text": "Your regex should find 21 non-spaces in \"MindYourPersonalSpace\"", - "testString": "assert(\"MindYourPersonalSpace\".match(countNonWhiteSpace).length == 21, 'Your regex should find 21 non-spaces in \"MindYourPersonalSpace\"');" + "text": + "Your regex should find 21 non-spaces in \"MindYourPersonalSpace\"", + "testString": + "assert(\"MindYourPersonalSpace\".match(countNonWhiteSpace).length == 21, 'Your regex should find 21 non-spaces in \"MindYourPersonalSpace\"');" } ], "solutions": [], @@ -1275,31 +1481,38 @@ "tests": [ { "text": "Your regex should use curly brackets.", - "testString": "assert(ohRegex.source.match(/{.*?}/).length > 0, 'Your regex should use curly brackets.');" + "testString": + "assert(ohRegex.source.match(/{.*?}/).length > 0, 'Your regex should use curly brackets.');" }, { "text": "Your regex should not match \"Ohh no\"", - "testString": "assert(!ohRegex.test(\"Ohh no\"), 'Your regex should not match \"Ohh no\"');" + "testString": + "assert(!ohRegex.test(\"Ohh no\"), 'Your regex should not match \"Ohh no\"');" }, { "text": "Your regex should match \"Ohhh no\"", - "testString": "assert(ohRegex.test(\"Ohhh no\"), 'Your regex should match \"Ohhh no\"');" + "testString": + "assert(ohRegex.test(\"Ohhh no\"), 'Your regex should match \"Ohhh no\"');" }, { "text": "Your regex should match \"Ohhhh no\"", - "testString": "assert(ohRegex.test(\"Ohhhh no\"), 'Your regex should match \"Ohhhh no\"');" + "testString": + "assert(ohRegex.test(\"Ohhhh no\"), 'Your regex should match \"Ohhhh no\"');" }, { "text": "Your regex should match \"Ohhhhh no\"", - "testString": "assert(ohRegex.test(\"Ohhhhh no\"), 'Your regex should match \"Ohhhhh no\"');" + "testString": + "assert(ohRegex.test(\"Ohhhhh no\"), 'Your regex should match \"Ohhhhh no\"');" }, { "text": "Your regex should match \"Ohhhhhh no\"", - "testString": "assert(ohRegex.test(\"Ohhhhhh no\"), 'Your regex should match \"Ohhhhhh no\"');" + "testString": + "assert(ohRegex.test(\"Ohhhhhh no\"), 'Your regex should match \"Ohhhhhh no\"');" }, { "text": "Your regex should not match \"Ohhhhhhh no\"", - "testString": "assert(!ohRegex.test(\"Ohhhhhhh no\"), 'Your regex should not match \"Ohhhhhhh no\"');" + "testString": + "assert(!ohRegex.test(\"Ohhhhhhh no\"), 'Your regex should not match \"Ohhhhhhh no\"');" } ], "solutions": [], @@ -1336,31 +1549,39 @@ "tests": [ { "text": "Your regex should use curly brackets.", - "testString": "assert(haRegex.source.match(/{.*?}/).length > 0, 'Your regex should use curly brackets.');" + "testString": + "assert(haRegex.source.match(/{.*?}/).length > 0, 'Your regex should use curly brackets.');" }, { "text": "Your regex should not match \"Hazzah\"", - "testString": "assert(!haRegex.test(\"Hazzah\"), 'Your regex should not match \"Hazzah\"');" + "testString": + "assert(!haRegex.test(\"Hazzah\"), 'Your regex should not match \"Hazzah\"');" }, { "text": "Your regex should not match \"Hazzzah\"", - "testString": "assert(!haRegex.test(\"Hazzzah\"), 'Your regex should not match \"Hazzzah\"');" + "testString": + "assert(!haRegex.test(\"Hazzzah\"), 'Your regex should not match \"Hazzzah\"');" }, { "text": "Your regex should match \"Hazzzzah\"", - "testString": "assert(haRegex.test(\"Hazzzzah\"), 'Your regex should match \"Hazzzzah\"');" + "testString": + "assert(haRegex.test(\"Hazzzzah\"), 'Your regex should match \"Hazzzzah\"');" }, { "text": "Your regex should match \"Hazzzzzah\"", - "testString": "assert(haRegex.test(\"Hazzzzzah\"), 'Your regex should match \"Hazzzzzah\"');" + "testString": + "assert(haRegex.test(\"Hazzzzzah\"), 'Your regex should match \"Hazzzzzah\"');" }, { "text": "Your regex should match \"Hazzzzzzah\"", - "testString": "assert(haRegex.test(\"Hazzzzzzah\"), 'Your regex should match \"Hazzzzzzah\"');" + "testString": + "assert(haRegex.test(\"Hazzzzzzah\"), 'Your regex should match \"Hazzzzzzah\"');" }, { - "text": "Your regex should match \"Hazzah\" with 30 z\\'s in it.", - "testString": "assert(haRegex.test(\"Ha\" + \"z\".repeat(30) + \"ah\"), 'Your regex should match \"Hazzah\" with 30 z\\'s in it.');" + "text": + "Your regex should match \"Hazzah\" with 30 z\\'s in it.", + "testString": + "assert(haRegex.test(\"Ha\" + \"z\".repeat(30) + \"ah\"), 'Your regex should match \"Hazzah\" with 30 z\\'s in it.');" } ], "solutions": [], @@ -1397,27 +1618,34 @@ "tests": [ { "text": "Your regex should use curly brackets.", - "testString": "assert(timRegex.source.match(/{.*?}/).length > 0, 'Your regex should use curly brackets.');" + "testString": + "assert(timRegex.source.match(/{.*?}/).length > 0, 'Your regex should use curly brackets.');" }, { "text": "Your regex should not match \"Timber\"", - "testString": "assert(!timRegex.test(\"Timber\"), 'Your regex should not match \"Timber\"');" + "testString": + "assert(!timRegex.test(\"Timber\"), 'Your regex should not match \"Timber\"');" }, { "text": "Your regex should not match \"Timmber\"", - "testString": "assert(!timRegex.test(\"Timmber\"), 'Your regex should not match \"Timmber\"');" + "testString": + "assert(!timRegex.test(\"Timmber\"), 'Your regex should not match \"Timmber\"');" }, { "text": "Your regex should not match \"Timmmber\"", - "testString": "assert(!timRegex.test(\"Timmmber\"), 'Your regex should not match \"Timmmber\"');" + "testString": + "assert(!timRegex.test(\"Timmmber\"), 'Your regex should not match \"Timmmber\"');" }, { "text": "Your regex should match \"Timmmmber\"", - "testString": "assert(timRegex.test(\"Timmmmber\"), 'Your regex should match \"Timmmmber\"');" + "testString": + "assert(timRegex.test(\"Timmmmber\"), 'Your regex should match \"Timmmmber\"');" }, { - "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.');" + "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.');" } ], "solutions": [], @@ -1454,19 +1682,23 @@ "tests": [ { "text": "Your regex should use the optional symbol, ?.", - "testString": "assert(favRegex.source.match(/\\?/).length > 0, 'Your regex should use the optional symbol, ?.');" + "testString": + "assert(favRegex.source.match(/\\?/).length > 0, 'Your regex should use the optional symbol, ?.');" }, { "text": "Your regex should match \"favorite\"", - "testString": "assert(favRegex.test(\"favorite\"), 'Your regex should match \"favorite\"');" + "testString": + "assert(favRegex.test(\"favorite\"), 'Your regex should match \"favorite\"');" }, { "text": "Your regex should match \"favourite\"", - "testString": "assert(favRegex.test(\"favourite\"), 'Your regex should match \"favourite\"');" + "testString": + "assert(favRegex.test(\"favourite\"), 'Your regex should match \"favourite\"');" }, { "text": "Your regex should not match \"fav\"", - "testString": "assert(!favRegex.test(\"fav\"), 'Your regex should not match \"fav\"');" + "testString": + "assert(!favRegex.test(\"fav\"), 'Your regex should not match \"fav\"');" } ], "solutions": [], @@ -1507,15 +1739,18 @@ "tests": [ { "text": "Your regex should use two positive lookaheads.", - "testString": "assert(pwRegex.source.match(/\\(\\?=.*?\\)\\(\\?=.*?\\)/) !== null, 'Your regex should use two positive lookaheads.');" + "testString": + "assert(pwRegex.source.match(/\\(\\?=.*?\\)\\(\\?=.*?\\)/) !== null, 'Your regex should use two positive lookaheads.');" }, { "text": "Your regex should not match \"astronaut\"", - "testString": "assert(!pwRegex.test(\"astronaut\"), 'Your regex should not match \"astronaut\"');" + "testString": + "assert(!pwRegex.test(\"astronaut\"), 'Your regex should not match \"astronaut\"');" }, { "text": "Your regex should not match \"airplanes\"", - "testString": "assert(!pwRegex.test(\"airplanes\"), 'Your regex should not match \"airplanes\"');" + "testString": + "assert(!pwRegex.test(\"airplanes\"), 'Your regex should not match \"airplanes\"');" }, { "text": "Your regex should not match \"banan1\"", @@ -1523,19 +1758,23 @@ }, { "text": "Your regex should match \"bana12\"", - "testString": "assert(pwRegex.test(\"bana12\"), 'Your regex should match \"bana12\"');" + "testString": + "assert(pwRegex.test(\"bana12\"), 'Your regex should match \"bana12\"');" }, { "text": "Your regex should match \"abc123\"", - "testString": "assert(pwRegex.test(\"abc123\"), 'Your regex should match \"abc123\"');" + "testString": + "assert(pwRegex.test(\"abc123\"), 'Your regex should match \"abc123\"');" }, { "text": "Your regex should not match \"123\"", - "testString": "assert(!pwRegex.test(\"123\"), 'Your regex should not match \"123\"');" + "testString": + "assert(!pwRegex.test(\"123\"), 'Your regex should not match \"123\"');" }, { "text": "Your regex should not match \"1234\"", - "testString": "assert(!pwRegex.test(\"1234\"), 'Your regex should not match \"1234\"');" + "testString": + "assert(!pwRegex.test(\"1234\"), 'Your regex should not match \"1234\"');" } ], "solutions": ["var pwRegex = /(?=\\w{5})(?=\\D*\\d{2})/;"], @@ -1573,44 +1812,56 @@ ], "tests": [ { - "text": "Your regex should use the shorthand character class for digits.", - "testString": "assert(reRegex.source.match(/\\\\d/), 'Your regex should use the shorthand character class for digits.');" + "text": + "Your regex should use the shorthand character class for digits.", + "testString": + "assert(reRegex.source.match(/\\\\d/), 'Your regex should use the shorthand character class for digits.');" }, { "text": "Your regex should reuse the capture group twice.", - "testString": "assert(reRegex.source.match(/\\\\\\d/g).length === 2, 'Your regex should reuse the capture group twice.');" + "testString": + "assert(reRegex.source.match(/\\\\\\d/g).length === 2, 'Your regex should reuse the capture group twice.');" }, { - "text": "Your regex should have two spaces separating the three numbers.", - "testString": "assert(reRegex.source.match(/\\\\s/g).length === 2, 'Your regex should have two spaces separating the three numbers.');" + "text": + "Your regex should have two spaces separating the three numbers.", + "testString": + "assert(reRegex.source.match(/\\\\s/g).length === 2, 'Your regex should have two spaces separating the three numbers.');" }, { "text": "Your regex should match \"42 42 42\".", - "testString": "assert(reRegex.test(\"42 42 42\"), 'Your regex should match \"42 42 42\".');" + "testString": + "assert(reRegex.test(\"42 42 42\"), 'Your regex should match \"42 42 42\".');" }, { "text": "Your regex should match \"100 100 100\".", - "testString": "assert(reRegex.test(\"100 100 100\"), 'Your regex should match \"100 100 100\".');" + "testString": + "assert(reRegex.test(\"100 100 100\"), 'Your regex should match \"100 100 100\".');" }, { "text": "Your regex should not match \"42 42 42 42\".", - "testString": "assert.equal((\"42 42 42 42\").match(reRegex.source), null, 'Your regex should not match \"42 42 42 42\".');" + "testString": + "assert.equal((\"42 42 42 42\").match(reRegex.source), null, 'Your regex should not match \"42 42 42 42\".');" }, { "text": "Your regex should not match \"42 42\".", - "testString": "assert.equal((\"42 42\").match(reRegex.source), null, 'Your regex should not match \"42 42\".');" + "testString": + "assert.equal((\"42 42\").match(reRegex.source), null, 'Your regex should not match \"42 42\".');" }, { "text": "Your regex should not match \"101 102 103\".", - "testString": "assert(!reRegex.test(\"101 102 103\"), 'Your regex should not match \"101 102 103\".');" + "testString": + "assert(!reRegex.test(\"101 102 103\"), 'Your regex should not match \"101 102 103\".');" }, { "text": "Your regex should not match \"1 2 3\".", - "testString": "assert(!reRegex.test(\"1 2 3\"), 'Your regex should not match \"1 2 3\".');" + "testString": + "assert(!reRegex.test(\"1 2 3\"), 'Your regex should not match \"1 2 3\".');" }, { "text": "Your regex should match \"10 10 10\".", - "testString": "assert(reRegex.test(\"10 10 10\"), 'Your regex should match \"10 10 10\".');" + "testString": + "assert(reRegex.test(\"10 10 10\"), 'Your regex should match \"10 10 10\".');" } ], "solutions": [], @@ -1647,16 +1898,21 @@ ], "tests": [ { - "text": "You should use .replace() to search and replace.", - "testString": "assert(code.match(/\\.replace\\(.*\\)/), 'You should use .replace() to search and replace.');" + "text": + "You should use .replace() to search and replace.", + "testString": + "assert(code.match(/\\.replace\\(.*\\)/), 'You should use .replace() to search and replace.');" }, { - "text": "Your regex should change \"This sandwich is good.\" to \"This sandwich is okey-dokey.\"", - "testString": "assert(result == \"This sandwich is okey-dokey.\" && replaceText === \"okey-dokey\", 'Your regex should change \"This sandwich is good.\" to \"This sandwich is okey-dokey.\"');" + "text": + "Your regex should change \"This sandwich is good.\" to \"This sandwich is okey-dokey.\"", + "testString": + "assert(result == \"This sandwich is okey-dokey.\" && replaceText === \"okey-dokey\", 'Your regex should change \"This sandwich is good.\" to \"This sandwich is okey-dokey.\"');" }, { "text": "You should not change the last line.", - "testString": "assert(code.match(/result\\s*=\\s*huhText\\.replace\\(.*?\\)/), 'You should not change the last line.');" + "testString": + "assert(code.match(/result\\s*=\\s*huhText\\.replace\\(.*?\\)/), 'You should not change the last line.');" } ], "solutions": [], @@ -1691,16 +1947,21 @@ ], "tests": [ { - "text": "result should equal to \"Hello, World!\"", - "testString": "assert(result == \"Hello, World!\", 'result should equal to \"Hello, World!\"');" + "text": + "result should equal to \"Hello, World!\"", + "testString": + "assert(result == \"Hello, World!\", 'result should equal to \"Hello, World!\"');" }, { "text": "You should not use the .trim() method.", - "testString": "assert(!code.match(/\\.trim\\(.*?\\)/), 'You should not use the .trim() method.');" + "testString": + "assert(!code.match(/\\.trim\\(.*?\\)/), 'You should not use the .trim() method.');" }, { - "text": "The result variable should not be set equal to a string.", - "testString": "assert(!code.match(/result\\s*=\\s*\".*?\"/), 'The result variable should not be set equal to a string.');" + "text": + "The result variable should not be set equal to a string.", + "testString": + "assert(!code.match(/result\\s*=\\s*\".*?\"/), 'The result variable should not be set equal to a string.');" } ], "solutions": [],