Possible Confusion: Match Single Character with Multiple Possibilities

In the challenge Regular Expressions: Match Single Character with Multiple Possibilities, the example code shows

let bgRegex = /b[aiu]g/;

which would normally work. However, the solution,

let vowelRegex = /[aeiou]/gi;

requires the global and ignore case flags to be outside the literal regex.

If done as

let vowelRegex = /[aeiou]gi/;

an empty array is returned.

I thought I would mention this in case someone was confused on what to do.

That g in the example is not the general flag, but the letter "g".
/b[aiu]g/ will match bag, big or bug, whereas /b[aiu]g/g will match all the occurences.

/[aeiou]gi/ this will match the first occurence of agi, egi, igi, oig or ugi.

This tool is nice to test your regex: https://regexr.com/


I see now. Regex has always been confusing but with the additions to the curriculum, it seems easier. Thanks for the recommendation of the tool too!