Match Single Characters Not Specified lesson

Is it me or the lesson is badly written when it asks to match all characters that are not a number?

Your code so far

Summary

let quoteSample = "3 blind mice.";
let myRegex = /[^aeiou0-9]/gi; // 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/96.0.4664.110 Safari/537.36

Challenge: Match Single Characters Not Specified

Link to the challenge:

Edit: thanks for help I figured it out :slight_smile:

1 Like

The instructions I’m seeing for this challenge say:

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

had no problem understanding the vowel part but not a number, like there are infinite numbers got me confused lol

Yes, but you are matching individual characters here, and so there are only 10 numbers that a character could be.

2 Likes

if I am matching it off the string, it’s still 11 characters, where did you get 10 numbers from?

Would you prefer digit or numeral?

1 Like

The use of the word ‘number’ is consistent with previous lessons;1:

1 Like

Yes, you are applying the regex to a string but the pattern is only looking at one character in the string at a time.

/[^aeiou0-9]/gi

This says “For each character in the string check if it is not a vowel and not a number”. Since the pattern is only being applied to one character at a time, how many possible numbers, digits, numerals, etc… are there for a character in the string?

2 Likes