Tell us what’s happening:
This lesson is confusing because it asks you to match all characters in the string, but the supposed solution doesn’t account for the period at the end of the sentence. I wasted a bunch of time trying to figure out what was wrong because I kept trying to add the period to the regex check, but apparently it only wants the user to check [a-z].
Should the solution not account for the period at the end of the sentence?
Your code so far
let quoteSample = "The quick brown fox jumps over the lazy dog.";
let alphabetRegex = /[a-z]./ig; // Change this line
let result = quoteSample.match(alphabetRegex); // 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/184.108.40.206 Safari/537.36
Challenge: Regular Expressions - Match Letters of the Alphabet
The instructions says “Match all letters in the string quoteSample”. The question you have to answer is the period a letter or are the space characters letters? Also, if you really want to match the period at the end along with the letters, you would not use the regular expression you have above.
I had assumed based on the lessons thus far, that they were asking for all characters in the string to be matched. As I had not made it to the section on ‘non-letter’ matching, I of course did not use the regular expression correctly for that.
I understand. It’s just the way the text of the lesson is worded, talking about matching “characters” that made it seem like the period should be included. It’s a simple mistake, but if I made it, surely others could be confused as well. It would be simpler if they removed the period from the string, to avoid confusion.