* chore(learn): audit basic algorithm scripting * chore(learn): audit basic data structures * chore(learn): audit basic javascript * chore(learn): audit debugging * chore(learn): audit es6 * chore(learn): audit functional programming * chore(learn): audit intermidate algorithms * chore(learn): audit js projects * chore(learn): audit object oriented programming * chore(learn): audit regex * fix(learn): remove stray . * fix(learn): string to code * fix(learn): missed some * fix(learn): clarify strings Based on Randy's feedback, clarifies string instances where quotes were removed in favour of back ticks. * fix: apply suggestions - thanks Randy! :) Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * fix: non-suggestion comments * chore(learn): remove comments from codes Removes the comments from the description and instruction code blocks to ensure that all relevant information is translatable. * fix: Apply suggestions from code review Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * fix: revert crowdin fix * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * fix: Apply suggestions from code review Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * fix: Apply suggestions from code review Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * chore: change voice * fix: Christopher Nolan * fix: expressions would evaluate * fix: will -> would * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.md Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * fix: to work to push * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.md Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2.4 KiB
id, title, challengeType, forumTopicId, dashedName
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
587d7db6367417b2b2512b9a | Match Characters that Occur Zero or More Times | 1 | 301351 | match-characters-that-occur-zero-or-more-times |
--description--
The last challenge used the plus +
sign to look for characters that occur one or more times. There's also an option that matches characters that occur zero or more times.
The character to do this is the asterisk or star: *
.
let soccerWord = "gooooooooal!";
let gPhrase = "gut feeling";
let oPhrase = "over the moon";
let goRegex = /go*/;
soccerWord.match(goRegex);
gPhrase.match(goRegex);
oPhrase.match(goRegex);
In order, the three match
calls would return the values ["goooooooo"]
, ["g"]
, and null
.
--instructions--
For this challenge, chewieQuote
has been initialized as the string 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.
--hints--
Your regex chewieRegex
should use the *
character to match zero or more a
characters.
assert(/\*/.test(chewieRegex.source));
Your regex should match the string A
in chewieQuote
.
assert(result[0][0] === 'A');
Your regex should match the string Aaaaaaaaaaaaaaaa
in chewieQuote
.
assert(result[0] === 'Aaaaaaaaaaaaaaaa');
Your regex chewieRegex
should match 16 characters in chewieQuote
.
assert(result[0].length === 16);
Your regex should not match any characters in the string He made a fair move. Screaming about it can't help you.
assert(
!"He made a fair move. Screaming about it can't help you.".match(chewieRegex)
);
Your regex should not match any characters in the string Let him have it. It's not wise to upset a Wookiee.
assert(
!"Let him have it. It's not wise to upset a Wookiee.".match(chewieRegex)
);
--seed--
--before-user-code--
const chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
--seed-contents--
// Only change code below this line
let chewieRegex = /change/; // Change this line
// Only change code above this line
let result = chewieQuote.match(chewieRegex);
--solutions--
let chewieRegex = /Aa*/;
let result = chewieQuote.match(chewieRegex);