Good question!
I've probably lost and regained around 10-15 stones in the course of my adult life, in around half a dozen or so serious to semi-serious dieting attempts. Every time I'd be going great guns, and then something would happen to derail me (boredom, a holiday, christmas, a change in my routine) and all the old habits would resurface and I always regained all of the lost weight and a few more bonus pounds as well.
That's why this time I'm not being complacent at all.
Instead of beating myself up about those past 'failures' I've started to think of them as 'practise attempts' instead. You don't learn to walk or ride a bike without falling down a few times, and weight loss is no different - it's a whole set of new skills and coping mechanisms that have to be learned and internalised, and that kind of knowledge and habit doesn't simply materialise overnight - it takes hard work and repetition and learning what does and doesn't work for your own personality and circumstances.
For myself I've realised that too much rigidity simply doesn't work. I've had my fair share of 1000 cal a day diets, and they never work in the long run. And since I don't want to live my life forever measuring and weighing, I've had to learn to curtail my appetite and judge my portion sizes and to stop when I've had enough, rather than to just blindly keep stuffing myself because my plate is still full.
With exercise, too, its a matter of finding something you enjoy doing, because I know that if I can't enjoy exercise it'll be the first thing I give up (I am SO lazy!)...so there's no point in me making a commitment to running a hundred miles a week or doing circuits 6 days out of 7 because I know I'd find it a hateful chore and quit doing it at the first opportunity.
Cycling and walking I love, though, so they are my exercise routines of choice, and ones that I can hopefully incorporate into my life for years into the future. And because I enjoy them I don't consider them a chore, and the plan is that I'll do them because I want to rather than because I feel I ought to...which come to think of it is what I want for every aspect of this getting healthy malarkey.
I've told myself that it's not a race, and every day I practise healthy living is a step in the right direction. If it takes me 10 years to get to goal it's OK, as long as I'm eating right and getting some exercise and moving in the right direction. Before, I used to get so impatient, and would literally feel like crying and taking a sledge hammer to the scales if they wouldn't show me a happy number. Now, I'm older and more realistic, and I know that all good things take time to mature, and I'll succeed in the long term only by realising that there are no short cuts and no easy fixes.
All the best for your next jump on the bandwagon,
Janey