The question is not how to stop having regrets. The question is what to do with the ones you have. A few things that actually work:
Name them specifically. Vague regret is the most corrosive kind. "I should have done things differently" is a sentence that can haunt you indefinitely because it has no edges. "I wish I had told my father I loved him before he died" is a sentence you can actually do something with. Not with him, but with the people who are still here. If you haven't yet written an advance directive, that is one of the most direct ways to act on the regret of not having said what you wanted to say.
Distinguish between regrets that are still actionable and regrets that aren't. Some of what you're grieving is genuinely over. The career you didn't pursue at 25 is not available to you at 65 in the same form. That is a real loss and it deserves to be mourned. But some of what you're grieving is not actually over. It has just been postponed. The relationship you haven't repaired. The thing you've always wanted to say. The place you've always wanted to go. Those are still available. The question is whether you're going to keep postponing them.
Write it down. Not as a confession or a lament, but as a record. What did you want? What did you choose instead? What were you afraid of? Writing forces specificity, and specificity is the enemy of the kind of diffuse, ambient regret that can color an entire life. You may find, when you write it out, that the unlived life you're grieving is smaller and more specific than it felt in your head. Or you may find that it is pointing at something you still have time to address. Either way, you will know more than you did.
The grief of an unlived life is real. It deserves to be taken seriously, not dismissed with reassurances about how everything happens for a reason. But it is also not the whole story. You are still here. The life you have is still happening. That is not nothing. In fact, for most of human history, it would have been considered an extraordinary stroke of luck. If the regret is specifically about a career that never happened, The Career Trap is worth reading next. If it is about feeling invisible and unheard, Nobody Wants Your Wisdom names that experience directly.