Time and a fair bit of hard work. You know that irritating old saying, take a hard look at yourself? Well, that applies to learning from our mistakes.

I've done things I regret. A few years ago I may have still felt embarrassed/bad/self loathing about it. Now I can look back and think, we'll that's who I was then and those are the choices I made. I lived with the consequences, but, more importantly, I did something about it. Sooner or later, I left that relationship, job, friendship. Physically or emotionally or both. Even when I thought I wouldn't survive, that I'd never have another job or relationship or whatever. At some stage, I stood up for myself or someone else and said no, this is wrong. And made a change.

I can't unmake the past. I cant predict the future, but I can influenece it by what I do in the present. Do you know the serenity prayer?
god grant me the serenity to accept the things I cannot change, the courage to change the things I can and the wisdom to know the difference
Easy words to write and say. Bloody hard to put into practice. I may not be religious, but sometimes I've had to learn to let go and hand stuff over to a higher power. I cannot change that person, what happened in the past, that situation. I cannot take back words said in anger, but I can try to put right what matters to me. I've disowned family and regained them again. I can't take back the hurt I caused but I can prevent causing more in future.

i suppose also, I can look back now and tell myself: You thought you wouldn't survive, but see you did. You met a better man, you got a better job, you have gained better friends. You've become a better person.

Those choices I made may have been bad but they weren't the end of the world either.

I think if you regret without purpose, without action or without learning something about yourself, then it's a waste of energy. If you can say, I regret this, but I have learnt X or I will try to learn Y, then you learn to live with it. You learn to forgive yourself and eventually, you learn to forgive others.