Match Characters that Occur Zero or More Times help!

***I do not understand how the code will give me the result of
sixteen character match of “Aaaaaaaaaaaaaaaa”.
Why does the code have to be:
“forward-slash a a asterisk a forward-slash i”?
why can’t it be:
“forward-slash a a asterisk forward-slash i” in the Regex?

(sorry about the type-out of the code as it wont let me use the asterisk symbol)

To figure out the answer, you have to use the hint because this is
not discussed in the lesson.

Your code so far


let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
let chewieRegex = /aa*a/i; // Change this line
let result = chewieQuote.match(chewieRegex);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 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

If you want code to display in a post surround it by single backticks. If you want to display multi-line code segments, then put only 3 backticks on a single line, followed by the code you want to show and then followed by a separate line of 3 backticks.

/aa*a/i

Will match for ‘a’ followed by zero or any number of ‘a’ followed by an a. So at minimum there must be two ‘a’ like 'aa'

While

/aa*/i

Will match for ‘a’ followed by zero or any number of ‘a’. This means if the string has even one ‘a’ anywhere, a match will be found. In this challenge, the last two strings would go through even though they shouldn’t.