Regular Expressions: Match Letters dot

Regular Expressions: Match Letters dot
0

#1

I solved the challenge but have a question.

The challenge: Match all the letters in the string quoteSample.

My solution:

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

My question:

let alphabetRegex = /[a-z]./;

How come this throws an error? Doesn’t the dot match all letter cases?


#2

What error does it throw?
Where are you seeing the error?
Can you post all the code you are using when you get the error?


#3

Here’s the full code:

let quoteSample = "The quick brown fox jumps over the lazy dog.";
let alphabetRegex = /[a-z]./; // Change this line
let result = quoteSample.match(alphabetRegex); // Change this line

And the error message:

// running tests
Your regex alphabetRegex should match 35 items.
Cannot read property 'length' of null
Cannot read property 'length' of null
// tests completed