Match Characters that Occur Zero or More Times3

Tell us what’s happening:
Hello thanks for helping, in the conditions to pass the challenge says:
our regex chewieRegex should use the * character to match zero or more a characters.

Passed

Your regex chewieRegex should match 16 characters.

Passed

Your regex should match "Aaaaaaaaaaaaaaaa" .

Here is where I can’t figure out how to complete the challenge since I am trying to get the cases where matchs with “a” but at the same time it is asking to not to match any characters in the sentences wich includes the letters I am looking for.
Your regex should not match any characters in "He made a fair move. Screaming about it can't help you."

Your regex should not match any characters in "Let him have it. It's not wise to upset a Wookiee."

Thanks so much, also I found in the forums:

/a-r/ will search for just that, “a-r”. Here’s an example:

let chewieQuote = "Aaaaaaaaaaaaaaa-rrrgh!";
let chewieRegex = /a-r*/i; 
let result = chewieQuote.match(chewieRegex);
console.log(result); //returns "a-rrr"

when I add “-r*” it detects that it doesn’t match any characters in the last two conditions but fails to detects the characters in the first conditions.
Your code so far


let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
let chewieRegex = /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; rv:64.0) Gecko/20100101 Firefox/64.0.

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

found the solution on the forum sorry for reuploading the topic
just need to add A[a]*

1 Like