Speaking as a guy who has cheated and regrets the decision, how can I learn to change my behaviour and never repeat that mistake?

I was in a 1.5 year long relationship that ended this past year due to my poor decision making and inability to handle my vulnerability and need for validation. I ended up cheating on my girlfriend (engaging in sexual conversations with girls I met on dating apps both prior to and during the relationship, but did not physically meet these girls). I have spent the past few months doing a lot of self reflection and learning about why I behaved the way I did. I just hate how my past mistakes never seem to leave me. How can I move on from my past actions and lead a faithful honest life? I have no intentions of making those mistakes again.
Speaking as a guy who has cheated and regrets the decision, how can I learn to change my behaviour and never repeat that mistake?
Post Opinion