$ sign explanation and application

Tell us what’s happening:

So I googled the $ and I do not understand what it means.

I can you explain what it does in general and how it applies to this problem? I do not understand why its necessary to include in this problem.

Your code so far


let repeatNum = "42 42 42";
let reRegex = /(\d+)\s\1\s\1/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/72.0.3626.121 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups

$ means “End of the string”.

So for example /les$/ will match “les” in “miles”, but won’t match “les” in “lifeless”.

Go to https://regexr.com/ paste a regex and it’ll give you detailed explanation.