I can relate to your sitch. I really struggled with detachment. I was obsessed with my ex and analyzed every thing she said, did etc. It was torture for me.
I did end up getting her back eventually after I went pitch black no contact for months on end(she left again 10 months later). I had to delete her phone number, unfriend her on social media, delete every picture I had of her etc. I forced myself to not look her up online. Basically I had to pretend that she had passed away.
Going no contact was truly a life saver. Not knowing what she was doing, or who she was doing it with really helped me. I started lifting weights and took up mountain biking and started to regain my confidence again. I can't stress how important the gym is, I still go 5x a week and I will continue going until I'm physically unable.
I havent spoken to my ex in almost 3 years and my life is so much better than it was when we were together.