Issue in exercise?


I am writing this because think there might be an issue with this exercise. In the last condition to pass it is saying that " Your regex should not match the string Cal in the middle of a string.". I test this outside of the coding environment o by using let rickyAndCal = “And Ricky both like Cal racing.”; to test against the regex expression and it came up false as it should, but for some reason the third condition “Your regex should match the string Cal at the beginning of the string.” still passed which I don’t think it should have after I swapped around Cal’s position in the sentence, or I am interpreting this lesson. The code below is showing the full version with the swapped around sentence. Just let me know if what I suspect is true, or I just interpreted this lesson incorrectly.

Your code so far

let rickyAndCal = "And Ricky both like Cal racing.";
let calRegex = /^Cal/; // Change this line
let result = calRegex.test(rickyAndCal);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0

Challenge: Match Beginning String Patterns

Link to the challenge:

Tests in this challenge are using internally calRegex checked against string specified in test. They are not using directly the rickyAndCal string or result.

When I run your code, all the tests pass. Try resetting the challenge and inputting your solution again.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.