How to deal with an ex that keeps messing with your head?

We broke up last January. I had started to develop deeper feelings for him, but he told me he just wanted to be friends. We didn't date very long, few months, but he was actually my first ever boyfriend and I was his first girlfriend. That being said, I understood the reasons behind his lack of feelings, but it hurt me. It still hurts.
For a while he kept asking if we could be friends and hang out, but I told him I wasn't ready. Then in the middle of nowhere he sent me a text "When are we getting back together ;(" And later "maybe it's better we stayed friends so nobody gets hurt". Which did not only raise my hopes up, but also crushed them all pretty quickly.

I started dating other people. No new messages for months, and I forgot about him. And last week he messaged me again. Wanting to talk. Telling me he has only now started to understand what kind of "treasure" I was, after dating other people. That I'm perfect girlfriend material and I'll make someone happy and HE isn't ready to be friends just yet. I don't know what to think. I don't know what to do. I don't understand what he even means. Any tips? This is a new situation for me.
How to deal with an ex that keeps messing with your head?
Add Opinion