I thought ^ was a negation operator. Why is $ put at the end?
^
is only the negation operator when it is at the start of a capturing group, like this: [^abc]
Otherwise, ^
matches the start of a string.
$
matches the end of a string.
You bring up a good point â regular expression syntax can be quite unclear because each characterâs meaning depends on itâs context.
Youâre missing the second \s and the \2 is not needed.
let reRegex = /^(\d+)\s\1\s\1$/;
Hey you explain better than FCC !!
@joker314 thank you so much best explanation.