Match Characters that Occur Zero or More Times HELP

Match Characters that Occur Zero or More Times HELP


what am i doing wrong here

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:


a* matches nothing (0 or more)
try +


remember that regextester I suggested you use to check? Here’s what you would have seen if you had tested your regex there:


but then i am supposed to be matching in this lesson using *


ok, so perhaps you need to match the first letter first exactly and then the rest of the a’s less specifically (with the star). Give it a try on regextester till you get the hang of it…


i tried using gi flags,first three tests are passed but they said in the lesson that it does not need flags


right, no flag is needed.

Think about how to match this exact string.
It start with an A…

Hope this is enough clue. And I really do suggest you try the regextester


okay got it i used Aa to pass the test but it shouldnt have passed because the other test says do not match it with a line that has a in it and in the example code they extracted g even after putting in /go*/. i dont get it


the reason /go*/ matches a ‘g’ or a ‘go’ or a ‘gooooo’ is because it actually looks for

one g and
zero or more o

so therefore
‘g’ has one g and zero o
‘go’ has one g and one o
‘goooo’ has one g and 4 os


so if the condition of matching A is not met it stops checking for a* ?


yes correct Aa* will only match ‘A’ or ‘Aa’ or ‘Aaa’ etc.


For this problem, the ‘Aa’ also helps distinguish the difference between a single ‘a’ vs. ‘Aaaaaaargh’


Another way to look at it, if I’m not stabbing a dead body.

To regular expressions: ‘A’ is a completely different from ‘a’. They are two distinct characters to search for.


The question don’t allow to use regex flag so the simple answer is Aaaaaaaaaaaaaaaa*


The instructions are unfortunately not very clear on the problem. I totally get the disconnect as I faced it as well.
To,possibly, help clarify the instructions…they want you to identify the capital “A” followed by the other ‘a’’ characters that follow.-not simply any "a"s in any random quote.
Maybe that could help.
I feel your pain though my friend.
Happy Coding!