fix/regex-upper-and-lower-bounds-tests (#36059)

* fix/regex-upper-and-lower-bounds-tests

* fix/add-solution-back

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.english.md

Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Tom
2019-06-25 16:45:20 -05:00
committed by Randell Dawson
parent 43a125217c
commit 51b5defb7e

View File

@ -22,7 +22,7 @@ multipleA.test(A2); // Returns false
## Instructions
<section id='instructions'>
Change the regex <code>ohRegex</code> to match only <code>3</code> to <code>6</code> letter <code>h</code>'s in the word <code>"Oh no"</code>.
Change the regex <code>ohRegex</code> to match the entire phrase <code>"Oh no"</code> only when it has <code>3</code> to <code>6</code> letter <code>h</code>'s.
</section>
## Tests
@ -31,19 +31,19 @@ Change the regex <code>ohRegex</code> to match only <code>3</code> to <code>6</c
```yml
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);
- text: Your regex should not match <code>"Ohh no"</code>
testString: assert(!ohRegex.test("Ohh no"), 'Your regex should not match <code>"Ohh no"</code>');
testString: assert(!ohRegex.test("Ohh no"));
- text: Your regex should match <code>"Ohhh no"</code>
testString: assert(ohRegex.test("Ohhh no"), 'Your regex should match <code>"Ohhh no"</code>');
testString: assert("Ohhh no".match(ohRegex)[0].length === 7);
- text: Your regex should match <code>"Ohhhh no"</code>
testString: assert(ohRegex.test("Ohhhh no"), 'Your regex should match <code>"Ohhhh no"</code>');
testString: assert("Ohhhh no".match(ohRegex)[0].length === 8);
- text: Your regex should match <code>"Ohhhhh no"</code>
testString: assert(ohRegex.test("Ohhhhh no"), 'Your regex should match <code>"Ohhhhh no"</code>');
testString: assert("Ohhhhh no".match(ohRegex)[0].length === 9);
- text: Your regex should match <code>"Ohhhhhh no"</code>
testString: assert(ohRegex.test("Ohhhhhh no"), 'Your regex should match <code>"Ohhhhhh no"</code>');
testString: assert("Ohhhhhh no".match(ohRegex)[0].length === 10);
- text: Your regex should not match <code>"Ohhhhhhh no"</code>
testString: assert(!ohRegex.test("Ohhhhhhh no"), 'Your regex should not match <code>"Ohhhhhhh no"</code>');
testString: assert(!ohRegex.test("Ohhhhhhh no"));
```
@ -51,7 +51,6 @@ tests:
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
@ -61,9 +60,6 @@ let result = ohRegex.test(ohStr);
```
</div>
</section>
## Solution
@ -74,4 +70,5 @@ let ohStr = "Ohhh no";
let ohRegex = /Oh{3,6} no/; // Change this line
let result = ohRegex.test(ohStr);
```
</section>