This is something I've done and a few of my children have done to address awful things that worked pretty well. Maybe it will help you too.
First - acceptance. When she comes to mind, remind yourself the relationship is over and it ended in a way that means it will never work out. She could come back begging and crying and you'd always be worried about it happening again. It's over. You're sad about it being over, and that's normal. Doing that makes it easier to think about other things.
Second - figure out what you're feeling insecure about. Bad things shake your confidence. It's normal. Figuring out how it's hurt you helps you rebuild.
Third - Make a list of everything you connect with these things. In your opinion, what does a smart man do? An attractive man? A good partner? How does he spend his time? What habits does he have?
Four - Work some of those into your new routine. If you think a successful man gets up and goes for a jog, start jogging. If a good partner is someone with a savings account, beef up your savings.
After 3 weeks or so, your self-esteem and confidence will start repairing itself and you won't have to struggle as much to keep this woman off your mind. Plus you'll have some new habits that you can keep up or ditch depending on how much you enjoy the results. Good luck.