I don’t understand why the ^ and $ are necessary in this problem. *From other problems, I’m getting that if I do the following
let re = /abc/ let teststr = 'abcdef'
then the match made would be ‘abc’, and not the entire string, ‘abcdef.’
So then why in this problem, if we don’t have the ^ and $, for strings such as “test test test test”, i.e. which contain the regex plus more, does the entire thing match?
*Maybe this is wrong? I have to say I found FCC doesn’t adequately explain Regex’s at all. It’s impossible from going through their examples to actually know how they work. I’ve been able to understand them better from other sources but this I still don’t get.