Regex Question (Regular Expressions: Reuse Patterns Using Capture Groups) BETA

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.