Tell us what’s happening:
I’m not passing the 42 42 42 42 test. My code is allowing this to go through, but it shouldn’t. I looked at some solutions and some people put /^(\d+)\s\1\s\1$/ , but I don’t understand why they put a caret and a dollar sign on the expression. The caret sign means negation. Why would they negate the capture values? The dollar sign means a repetition at the end. Why is that there? Can someone explain why those symbols allow this to work? Thanks.
Your code so far
let repeatNum = "42 42 42"; let reRegex = /(\d+)\s\1\s\1/; // Change this line let result = reRegex.test(repeatNum);
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36.