Typically in captivity not very long. Larger Gymnothorax species can live over 20 years, smaller ones over 10. Definately best off in a species mild brackish (1.005) tank.
Morays are definately a "monster", you should see my 30" horned moray. It's so aggressive it will come out of the tank during feeding. I find it ironic that the "FW" morays are harder to keep than most SW species.