Regular Expressions - Match Single Characters Not Specified

I don’t understand why the case sensitive flag is required in this code. They are all lowercase, so why do you need it?

let quoteSample = “3 blind mice.”;

let myRegex = /[^3ie]/g; // Change this line

let result = quoteSample.match(myRegex); // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36 Edg/110.0.1587.57

Challenge: Regular Expressions - Match Single Characters Not Specified

Link to the challenge:

Ya, I can understand your reasoning here based on code. I think the instructions:

“Create a single regex that matches all characters that are not a number or a vowel.”

Are meant to be applied to any string, not just the string in the example code. So in that case you would need to make sure you matched for both lower and uppercase.

But ya, a better example string in the instructions that has both uppercase and lowercase vowels would make more sense.

1 Like

ok I understand, thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.