Problem with Regexp: Match Characters that Occur Zero or More Times

Problem with Regexp: Match Characters that Occur Zero or More Times
0.0 0

#1

Tell us what’s happening:

Why does oPhrase.match(goRegex); returns Null??

There is an “o” in oPhrase…

Your code so far

let soccerWord = "gooooooooal!";
let gPhrase = "gut feeling";
let oPhrase = "over the moon";
let goRegex = /go*/;
soccerWord.match(goRegex); // Returns ["goooooooo"]
gPhrase.match(goRegex); // Returns ["g"]
oPhrase.match(goRegex); // Returns null

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0.

Link to the challenge:

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


#2

The pattern is /go*/, that is to say the pattern has a g followed by 0 or more os

There’s no g followed by o


#3

Ok And please in this exercie, where are the other 2 strings quoted??They are not in the instructions…

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.


#4

They are just in the test to make sure you are not just matching an a in the middle of a string