Tell us what’s happening:
I’m a bit confused as to why you need the not ^
here.
If I try
"Ricky is first and can be found.Ricky".match(/Ricky/);
it matches once because I am not doing a global search.
So just as a test I tried the below code which fails.
I do know the Regex should be ^Cal
, I just don’t understand why.
Can anyone explain?
Your code so far
let rickyAndCal = "Cal and Ricky both like racing.";
let calRegex = /Cal/; // Change this line
let result = calRegex.test(rickyAndCal);
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/67.0.3396.99 Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns