Is it just me or is there an error in the example here? and I’ve seen the same thing in some of the other exercises:
let firstString = "Ricky is first and can be found.";
let firstRegex = /^Ricky/;
firstRegex.test(firstString); //shouldn't this be firstString.test(firstRegex)?
// Returns true
let notFirst = "You can't find Ricky now.";
firstRegex.test(notFirst); //and shouldn't this be notFirst.test(firstRegex)
// Returns false
Whether this is right or wrong, I still don’t understand what part of the code is specifying the first part of the string. Again, in the explanation it mentions how using the caret inside the character set (like /^Ricky/ ) is to do with negated characters…
edit. Are these the opposite way round when using match/test? if so, that is so stupid
Unless I’ve misunderstood what the character set is…? maybe it means the square brackets? eg: /Ricky[^abc]/