Match Characters that Occur Zero or More Times Need Help

Tell us what’s happening:
why oPhrase.match(goRegex) return null even though I still see the “o” character in the oPhrase string?

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 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) coc_coc_browser/77.0.126 Chrome/71.0.3578.126 Safari/537.36.

Link to the challenge:

Your goRegex matches a “g” followed by zero or more "o"s. Since there is no “g” in “over the moon”, it won’t match.

1 Like

oh, i got it, thanks.