I just did this replacement. I recommend against standard AAA with the nipples, instead get flat-top NiMH AAA batteries with solder tabs pre-attached. You can buy them pretty cheap on Amazon:
Then you can make a decent connection with soldering optional as follows. Fold/clamp the solder tabs on the free end with a spare solder tab or the one from the old batteries. Do the same with the wires on the other end. Optionally, solidify the connection with solder if desired. This way you only need to solder the solder tabs together, don’t have to solder the battery directly and risk damage, fire, or explosion.