Tell us what’s happening:
Hello all, just a quick question about using * in a regex.
why is it that when I have a pattern that has something repeating zero or more times like in:
let test = “aaaaaaargh”;
And I use a regex such as:
let regex = /a*/gi;
it will show me the expression I was looking for with a bunch of empty strings when I print it to the console?
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36.
Challenge: Match Characters that Occur Zero or More Times
Link to the challenge: