Using the string “Cal and Ricky both like racing.”, they both would have “Cal” in the array, because in the first regex (below), It will match any single letter at the beginning of the string followed immediately by “al”. The “C” is a single letter at the beginning of the string, so “Cal” is matched.
let calRegex = /^[a-z]al/gi; // Change this line
In the second regex (below), it will only match “Cal” if these are the first three letters of the string.
let calRegex = /^Cal/; // Change this line
One notable difference between the two regular expressions is the first one would also match “cal” (lower case “c” because of the i flag). the second regex will not match “cal”, because you do not use the i flag.