[Resolved] Comma identified as a vowel in Regex match

[Resolved] Comma identified as a vowel in Regex match
0.0 0

#1

Tell us what’s happening:

Hey, I am on Regular Expressions - Match Single Character with Multiple Possibilities now . I am looking for vowels in a string, but somehow I get a comma in a search result. Anyone knows what’s going on here?

(26) [“e”, “a”, “e”, “o”, “u”, “i”, “e”, “a”, “o”, “e”, “o”, “e”, “I”, “a”, “e”, “o”, “o”, “e”, “i”, “o”, “e”, “,”, “o”, “i”, “e”, “i”]

Your code so far


let quoteSample = "Beware of bugs in the above code; I have only proved it correct, not tried it.";
let vowelRegex = /[a,e,i,o,u]/gi; // Change this line
let result = quoteSample.match(vowelRegex); // Change this line
console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-single-character-with-multiple-possibilities/


#2

Figured out my mistake. No comma needed inside []. Sorry for the post.