ohRegex
to match only 3
to 6
letter h
's in the word "Oh no"
.
+Change the regex ohRegex
to match the entire phrase "Oh no"
only when it has 3
to 6
letter h
's.
ohRegex
to match only 3
to 6 0, 'Your regex should use curly brackets.');
+ testString: assert(ohRegex.source.match(/{.*?}/).length > 0);
- 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"));
- text: Your regex should match "Ohhh no"
- testString: assert(ohRegex.test("Ohhh no"), 'Your regex should match "Ohhh no"
');
+ testString: assert("Ohhh no".match(ohRegex)[0].length === 7);
- text: Your regex should match "Ohhhh no"
- testString: assert(ohRegex.test("Ohhhh no"), 'Your regex should match "Ohhhh no"
');
+ testString: assert("Ohhhh no".match(ohRegex)[0].length === 8);
- text: Your regex should match "Ohhhhh no"
- testString: assert(ohRegex.test("Ohhhhh no"), 'Your regex should match "Ohhhhh no"
');
+ testString: assert("Ohhhhh no".match(ohRegex)[0].length === 9);
- text: Your regex should match "Ohhhhhh no"
- testString: assert(ohRegex.test("Ohhhhhh no"), 'Your regex should match "Ohhhhhh no"
');
+ testString: assert("Ohhhhhh no".match(ohRegex)[0].length === 10);
- 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"));
```
@@ -51,7 +51,6 @@ tests:
## Challenge Seed
-
```js
@@ -61,9 +60,6 @@ let result = ohRegex.test(ohStr);
```
-
-
-
## Solution
@@ -74,4 +70,5 @@ let ohStr = "Ohhh no";
let ohRegex = /Oh{3,6} no/; // Change this line
let result = ohRegex.test(ohStr);
```
+