Match Characters that Occur Zero or More Times error

Match Characters that Occur Zero or More Times error
0

#1

Tell us what’s happening:
For error announced: there should be 2 other strings for matching with the regex.
But they are not already available or pre-made in the code.

Your code so far


let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
let chewieRegex = /[Aa]*/; // Change this line
let result = chewieQuote.match(chewieRegex);

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 8.1.0; Redmi 6A Build/O11019) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times/


#3

Your current regular expression matches the first instance with zero or more characters which are an “A” or “a” . In the test string of “He made a fair move. Screaming about it can’t help you.”, the first instance of where there are zero or more “A” or “B” is the letter “H”. They do not want you matching such instances, which is why you fail this test.


#4

There are no other test strings. I told this.


#5

The other 2 test cases are not in the code section.

There are 5 tests (see bottom left-hand corner of your screen). There are 3 different test strings:

  1. “Aaaaaaaaaaaaaaaa”
  2. “He made a fair move. Screaming about it can’t help you.”
  3. “Let him have it. It’s not wise to upset a Wookiee.”

Per the instructions, your regular expression should match all 16 of the A/a characters in the the first test which happens to be in the code itself (chewieQuote). However, the instructions also state the regular expression should not match any of the other quotes (quotes in means the other 2 test cases - #2 and #3 above). See below for the challenge instructions:

Create a regex chewieRegex that uses the * character to match all the upper and lower"a" characters in chewieQuote. Your regex does not need flags, and it should not match any of the other quotes.


#6

OK. Thank you.
I made the question because for some other challenges the test strings were made ready in the code section.
Just so.