Replaying past interactions

I spend a lot of time repeating situations and interactions that have already happened in my head, feeling a lot of anxiety and regret about them. Most of the time they are related to work. I think for hours about things I did and said at work, even during evenings and weekends when I’m not working. I know there’s nothing I can do to change these situations, so there is no benefit to replaying them over and over. Here is a recent example;
C- Told colleague his comments were taken as offensive by others in the group.
T- I shouldn’t have brought it up with him.
F- regret
A- think about it all night and worry that I upset him
R- I’m not present with my family
How can I think differently about situations that have passed?