Link Search Menu Expand Document

Match Beginning String Patterns

Summary

  • When used outside of a character set, ^ is used to search for patterns at the beginning of a string.

Final Code

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