I have this code:
let quoteSample = "The quick brown fox jumps over the lazy dog."; let alphabetRegex = /[a-z]/i; // Change this line let result = quoteSample.match(alphabetRegex); // Change this line
I get errors:
Your regex alphabetRegex should match 35 items.
Cannot read property ‘length’ of null
Any ideas?
Cannot read property ‘length’ of null is a strange error for this code. Check which line has the error.
But, to match the whole sentence I think your regex should be:
let alphabetRegex = /[a-z]/gi;
Otherwise you are going to match just the first charactere.
Thanks for the reply. It works now.