Do you obsessively think about painful memories?

I seem to have a habit or maybe even a compulsion of replaying painful memories, a few in particular. The fact that I get so caught up in these thoughts, which are about events that happened a long time ago, really get in the way if me being happy in the present.

Has anyone dealt with this before?