Rexgex -that should match - matched

Tell us what’s happening:
i do not understand how did this following code return [g]

let gPhrase = "gut feeling";
let goRegex = /go*/;
gPhrase.match(goRegex); // Returns ["g"]

Your code so far

// Only change code below this line
let chewieRegex = /Aa*/; // Change this line
// Only change code above this line

let result = chewieQuote.match(chewieRegex);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36.

Challenge: Match Characters that Occur Zero or More Times

Link to the challenge:

In Regex, the * character means ‘match zero or more times’, so go* is matching a g followed by zero or more o

this is o not 0; please check.

Its says: match one g followed by zero or more o

1 Like