Regular Expressions - Match Characters that Occur Zero or More Times

Tell us what’s happening:
Describe your issue in detail here.
i guess i found a mistake in this challenge

this wrong. it suppose to be null too
Your code so far

// Only change code below this line
let chewieRegex = /change/; // Change this line
// Only change code above 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/106.0.0.0 Safari/537.36

Challenge: Regular Expressions - Match Characters that Occur Zero or More Times

Link to the challenge:

Why do you believe it is wrong?

let gPhrase = "gut feeling";

let goRegex = /go*/;
gPhrase.match(goRegex);

it returnes null …

no?

Run it. You should see what the result is.

1 Like

yep, sorry . i was wrong. but still have a question

let str =“gut feeling”
console.log(str.match(/go*/ig))

let str =“gut feeling”
console.log(str.match(/goo*/ig))

why does the first return ‘g’, but the second return null?

second one requires a g followed by an o
first one only requires a g

but first one also has an ‘o’ after g ----> str.match(/go*/ig)

The first regex says match the letter g followed by zero or more o.

gut feeling has a g followed by zero o, so it is a match.

1 Like