Skip to content
This repository was archived by the owner on Sep 25, 2019. It is now read-only.

Commit 296cf44

Browse files
RobAnthony01scissorsneedfoodtoo
authored andcommitted
fix(challenges): add test to check user is using \W in Regex
Add test to make sure user is using \W and not ^\w
1 parent 16d52cb commit 296cf44

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

challenges/02-javascript-algorithms-and-data-structures/regular-expressions.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,10 @@
944944
"text": "Your regex should find 6 non-alphanumeric characters in <code>\"The five boxing wizards jump quickly.\"</code>.",
945945
"testString": "assert(\"The five boxing wizards jump quickly.\".match(nonAlphabetRegex).length == 6, 'Your regex should find 6 non-alphanumeric characters in <code>\"The five boxing wizards jump quickly.\"</code>.');"
946946
},
947+
{
948+
"text": "Your regex should use the shorthand character.",
949+
"testString":"assert(/\\\\W/.test(nonAlphabetRegex.source), 'Your regex should use the shorthand character to match characters which are non-alphanumeric.');"
950+
},
947951
{
948952
"text": "Your regex should find 8 non-alphanumeric characters in <code>\"Pack my box with five dozen liquor jugs.\"</code>",
949953
"testString": "assert(\"Pack my box with five dozen liquor jugs.\".match(nonAlphabetRegex).length == 8, 'Your regex should find 8 non-alphanumeric characters in <code>\"Pack my box with five dozen liquor jugs.\"</code>');"
@@ -1718,4 +1722,4 @@
17181722
}
17191723
}
17201724
]
1721-
}
1725+
}

0 commit comments

Comments
 (0)