Match Beginning String Patterns

Match Beginning String Patterns
0.0 0

#1

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


#2

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

Your RegEx is looking for everything except Cal.


#3

Thanks I solved my problem.


#4

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


#5

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