I live in a place where the electricity quality is poor. If I plug my desktop computer directly into the wall, it ends up damaged after some days due to unstable electricity. I have used an UPS for some years, which solved the problem, but its batteries last only for a few years, what makes it an expensive solution on the long term.

I heard about Automatic Voltage Regulators and I would like to know if they would solve my problem. I'm not worried about loss of data due to occasional power failures, since that is not really a problem here, I would just need to protect my computer from damage.

What options do I have to protect my computer from bad quality electricity? Would Automatic Voltage Regulators be a good alternative to a UPS?