Match Beginning String Patterns

Tell us what’s happening:

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns

Be careful. You’re looking for Cal at the beginning of the string.

Your RegEx is looking for everything except Cal.

1 Like

Thanks I solved my problem.

If I may say so, that’s not exactly what is regex is looking for :slight_smile:

His regex is looking for strings beginning by and Ricky both like racing

1 Like

That is implied in my response, but I suppose I should have been more explicit.