What's wrong :Match Characters that Occur Zero or More Times

What's wrong :Match Characters that Occur Zero or More Times
0

#1

Tell us what’s happening:

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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 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


#2

Your regex should not match any characters in “He made a fair move. Screaming about it can&#39t help you.”

Your pattern match any char ( match a 0 or more times, so it matches everything^^)


#3

i still didn’t get you?


#4

/a*/ match when a character occurs 0 or more times
It means that on the string string it matches 7 times;

  • ``: it matches (a char occur 0 times);
  • s: it matches (a char occur 0 times);
  • st: it matches ( a char occur 0 times);
  • str: it matches (a char occur 0 times);
  • stri: it matches (a char occur 0 times);
  • strin: it matches (a char occur 0 times);
  • string: it matches (a char occur 0 times);

You are asked ( the last two conditions ) to not match any character in the statement they provide


#5

I faced the same problem, but look carefully what the “chewieQuote” is!
Try writing to match this. it is simple though but like a quirk


#6

I am trying to understand what you said but I still do not get a clue! Can you atleast give more explanations on this?


#7

/a*/i this match a 0 or more times, if you want for it to match something specific you need to add some other things to match around it


#8

Now that is the thing that is confusing me, I kinda fail to understand what is that thing that am suppose to add! Can you at least direct me to a lesson or challenge that can help me figure that out?


#9

Now I get it:
The secret is in the “chewieQuote” , its a bit quirky but doable.


#10

thanks, very helpful


#11

This challenge is so unclear on what are we even supposed to do with it. I am not struggling with regex, but with the challenge behind it.