-Create a regex chewieRegex
that uses the *
character to match all the upper and lowercase "a"
characters in chewieQuote
. Your regex does not need flags, and it should not match any of the other quotes.
+For this challenge, chewieQuote
has been initialized as "Aaaaaaaaaaaaaaaarrrgh!" behind the scenes. Create a regex chewieRegex
that uses the *
character to match an uppercase "A"
character immediately followed by zero or more lowercase "a"
characters in chewieQuote
. Your regex does not need flags or character classes, and it should not match any of the other quotes.
## Tests
@@ -22,15 +22,17 @@ Create a regex chewieRegex
that uses the *
character t
```yml
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 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"
.');
- - 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."
');
+ testString: assert(/\*/.test(chewieRegex.source));
+ - text: Your regex should match "A"
in chewieQuote
.
+ testString: assert(result[0][0] === 'A');
+ - text: Your regex should match "Aaaaaaaaaaaaaaaa"
in chewieQuote
.
+ testString: assert(result[0] === 'Aaaaaaaaaaaaaaaa');
+ - text: Your regex chewieRegex
should match 16 characters in chewieQuote
.
+ testString: assert(result[0].length === 16);
+ - 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));
+ - 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));
```
@@ -42,14 +44,20 @@ tests:
```js
-let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
-let chewieRegex = /change/; // Change this line
+let chewieRegex = /change/; // Only change this line
let result = chewieQuote.match(chewieRegex);
```
+## Before Test
+
+```js
+const chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
+```
+
+
@@ -57,7 +65,6 @@ let result = chewieQuote.match(chewieRegex);
```js
- let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
let chewieRegex = /Aa*/;
let result = chewieQuote.match(chewieRegex);
```