Really, there's no general rule. It can work, but that doesn't mean it will. You've got to be careful with getting back with an ex because the relationship ended for a reason. However that doesn't mean the relationship can't find its feet again.
My best friend got back together with her ex-boyfriend and they've been together for years, they seem to be very happy. However, I will say that a lot of time passed between their first relationship and when they got back together. They both had matured a lot, I'm not sure if that made any difference!