I don’t understand what is wrong with my code. when I run the code on my console, it does not match any characters for
“He made a fair move. Screaming about it can’t help you.” and
“Let him have it. It’s not wise to upset a Wookiee.”
yet it does not meet these requirements on the beta free code camp and would not submit to move me to the next level.
Your code so far
let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
let chewieRegex = /a*/i; // Change this line
let result = chewieQuote.match(chewieRegex);
console.log(result);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36.
Why include a+? Shouldn’t /aa*/ig be able to handle it?
Also, I think this is a confusing problem description.
“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."
So there should be one match?
“Your regex should not match any characters in “He made a fair move. Screaming about it can’t help you.””
Nevermind, I see that this is just a bad problem. The trick is to have it catch 2 or more a’s, but it requires a ‘*’ just because that is featured in the problem. In the real world, you would just use /aa+/gi