Here's a thought.
There's one ex you know is never coming back. You've accepted this. Still you can't help yourself; you just keep dreaming them again.
Meet someone new? Remember how you met your ex. Find that amazing experience again. Use the same words, same voice, same body language. The act of meeting someone new is a pean to the ex who is not coming back.
You're texting now. You kept those old messages? Wrote them down? Go through them. Find a way to spit this new relationship on that old pyre. Same words, same repartee. They won't play the part. Your ex is never coming back.
Longer letters. Longer. Maybe if you push hard enough, you can force them into the same shape. You write the stories, the memories, the outcomes, helpfully hinting them towards what they want to be. What you went them to be. They don't take the hint. They don't know the game you're playing.
So you end up with someone new and you miss your ex.
Or you end up alone and you miss your ex.
Here's a thought.