You are almost there and the main logic is good. but without a ^ at the beginning of your regex this can match the last three numbers of any repeating series of the same number. Such as: 2 2 2 2 would find a match in the last three 2s.
EDIT: i use this website extensively when building regex from scratch. the visualization and resources are super helpful: https://regex101.com/