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
Layer
October 10, 2018, 2:06pm
#2
Your regex should not match any characters in “He made a fair move. Screaming about it can't help you.”
Your pattern match any char ( match a 0 or more times, so it matches everything^^)
Layer
October 10, 2018, 6:02pm
#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
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
1 Like
ACAM023
February 8, 2019, 7:52am
#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?
ilenia
February 8, 2019, 8:24am
#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
1 Like
ACAM023
February 8, 2019, 8:28am
#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?
ACAM023
February 8, 2019, 8:40am
#9
Now I get it:
The secret is in the “chewieQuote” , its a bit quirky but doable.
1 Like
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.